           COPY IFGPARAM.
      ******************************************************************
      ***   TITEL        : DRUCKT EINE PCL5-DATEI AUF EINEN DRUCKER    *
      ***                                                              *
      ***                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      *
      ***                  ACHTUNG: WEGEN DER API-CALLS NUR UNTER      *
      ***                           WINDOWS MOEGLICH                   *
      ***                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!      *
      ***                                                              *
      ***   NAME         : YPCL2PR                                     *
      ***                                                              *
      ***   AUTHOR       : RAUCH                                       *
      ***                                                              *
      ***   ERSTELLT     : 04.09.2008                                  *
      ***                                                              *
      ***                                                              *
      ***                                                              *
      ******************************************************************
      *
      *
      ******************************************************************
      *
       IDENTIFICATION DIVISION.
      *
      ******************************************************************
      *
      *---------------------------*
       PROGRAM-ID. YPCL2PR.
      *---------------------------*
      *
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
           CALL-CONVENTION 74 IS WINAPI
           CALL-CONVENTION 66 IS WINAPI66
           COPY SPENAMES.
      *
      *
       INPUT-OUTPUT SECTION.
      *
       FILE-CONTROL.
           SELECT OPTIONAL EINGABE  ASSIGN TO DYNAMIC EINGABEEQ
                  FILE STATUS  IS FILE-RC.
           SELECT OPTIONAL AUSGABE  ASSIGN TO DYNAMIC AUSGABEEQ
                  FILE STATUS  IS FILE-RC.
           SELECT OPTIONAL PROTO    ASSIGN TO DYNAMIC PROTOEQ
                  COPY LINESEQ.
                  FILE STATUS  IS FILE-RC.
      *
      *
       DATA DIVISION.
      *
       FILE SECTION.
       FD          EINGABE.
       01          EINGABE-SATZ        PIC X(01).

       FD          AUSGABE.
       01          AUSGABE-SATZ        PIC X(01).

       FD          PROTO.
       01          PROTO-SATZ          PIC X(128).


      ******************************************************************
      *
       WORKING-STORAGE SECTION.
      *
      ******************************************************************
           78   RC-STRETCHBLT          VALUE H"0800".
           78   DM-IN-BUFFER           VALUE H"0008".
           78   DM-OUT-BUFFER          VALUE H"0002".
           78   DM-IN-OUT-BUFFER       VALUE H"000A".
           78   DM-ORIENTATION         VALUE H"0001".
           78   DM-PRINTQUALITY        VALUE H"0400".
           78   DM-YRESOLUTION         VALUE H"2000".
           78   DM-PAPERSIZE           VALUE H"0002".
           78   DM-PAPERLENGTH         VALUE H"0004".
           78   DM-PAPERWIDTH          VALUE H"0008".
           78   DM-FORMNAME            VALUE H"010000".
           78   HORZRES                VALUE 8.
           78   VERTRES                VALUE 10.
           78   LOGPIXELSX             VALUE 88.
           78   LOGPIXELSY             VALUE 90.
           78   PHYSICALWIDTH          VALUE 110.
           78   PHYSICALHEIGHT         VALUE 111.
           78   PHYSICALOFFSETX        VALUE 112.
           78   PHYSICALOFFSETY        VALUE 113.
           78   SCALINGFACTORX         VALUE 114.
           78   SCALINGFACTORY         VALUE 115.
           78   NOTSRCERASE            VALUE H"330008".
           78   SRCCOPY                VALUE H"CC0020".
           78   SRCPAINT               VALUE H"EE0086".
           78   SRCAND                 VALUE H"8800C6".
           78   SRCINVERT              VALUE H"660046".
           78   SRCERASE               VALUE H"440328".
           78   MERGECOPY              VALUE H"C000CA".
           78   MERGEPAINT             VALUE H"BB0226".
           78   PATCOPY                VALUE H"F00021".
           78   PATPAINT               VALUE H"FB0A09".
           78   PATINVERT              VALUE H"5A0049".
           78   DSTINVERT              VALUE H"550009".
           78   BLACKNESS              VALUE H"000042".
           78   WHITENESS              VALUE H"FF0062".
           78   OPERATION-DPO          VALUE H"FA0089".
           78   OPERATION-PSO          VALUE H"FC008A".
           78   OEM-FIXED-FONT         VALUE 10.
           78   ANSI-FIXED-FONT        VALUE 11.
           78   ANSI-VAR-FONT          VALUE 12.
           78   SYSTEM-FONT            VALUE 13.
           78   DEVICE-DEFAULT-FONT    VALUE 14.
           78   DEFAULT-GUI-FONT       VALUE 17.
           78   TRANSPARENT            VALUE 1.
           78   RASTERCAPS             VALUE 38.
           78   MB-PRECOMPOSED         VALUE H"0001".
           78   Default-Charset        VALUE 1.
           78   Draft-Quality          VALUE 1.


           COPY BIT3264.

           COPY WKSTD.

           COPY WKALPHAB.

           COPY WKBFSTA REPLACING 03 BY 01.

       01       EINGABEEQ             PIC X(255) VALUE SPACES.
       01       AUSGABEEQ             PIC X(255) VALUE SPACES.
       01       PROTOEQ               PIC X(255) VALUE SPACES.
       01       CSCLASS               PIC 9(09) COMP-5 VALUE H"0003".
       01       MAINSTYLE             PIC 9(09) COMP-5
                                                VALUE H"06CF0000".
      *                                                 1-VISIBLE
      *                                                  2-CLIPCHILDREN
      *                                                  4-CLIPSIBLINGS
      *                                                   4-DLGFRAME
      *                                                   8-BORDER
      *                                                    1-TABSTOP
      *                                                    2-GROUP
      *                                                    4-THICKFRAME
      *                                                    8-SYSMENU

       01       WKB-KONSTANTEN.
         05     WKB-X-MINUS            PIC S9(04) COMP-5 VALUE 0.
         05     WKB-Y-MINUS            PIC S9(04) COMP-5 VALUE 0.
         05     WKB-MAX-TRY            PIC S9(04) COMP-5 VALUE 100.
         05     WKB-CHAR-MAX           PIC S9(09) COMP-5 VALUE 262144.
         05     WKB-DPI-SOLL           PIC S9(09) COMP-5 VALUE 300.
         05     WKB-DPI-IST            PIC S9(09) COMP-5 VALUE 300.
         05     WKB-FAKTOR-XY          PIC S9(05)V9(04) COMP-5.
         05     WKB-ESC                PIC X(01) VALUE X"1B".
         05     WKB-CR                 PIC X(01) VALUE X"0D".
         05     WKB-LF                 PIC X(01) VALUE X"0A".
         05     WKB-FF                 PIC X(01) VALUE X"0C".
         05     WKB-ESC-STERN-KL-B.
          10    FILLER                 PIC X(01) VALUE X"1B".
          10    FILLER                 PIC X(02) VALUE "*b".
         05     WKB-ESC-9.
          10    FILLER                 PIC X(01) VALUE X"1B".
          10    FILLER                 PIC X(01) VALUE "9".
      *-----------------------------------------------------------------
      * 1: 1%
      *-----------------------------------------------------------------
         05     WKB-SHADES.
          10    WKB-SHADE-1-2.
           15   FILLER                 PIC X(06) VALUE "121212".
           15   FILLER1                PIC X(24) VALUE "X         ".
           15   FILLER2                PIC X(24) VALUE "          ".
           15   FILLER3                PIC X(24) VALUE "          ".
           15   FILLER4                PIC X(24) VALUE "          ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "      X   ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "           ".
      *-----------------------------------------------------------------
      * 2: 3,12%
      *-----------------------------------------------------------------
          10    WKB-SHADE-3-10.
      *    15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER                 PIC X(06) VALUE "080824".
           15   FILLER1                PIC X(24) VALUE "X         ".
           15   FILLER2                PIC X(24) VALUE "          ".
           15   FILLER3                PIC X(24) VALUE "          ".
           15   FILLER4                PIC X(24) VALUE "          ".
           15   FILLER5                PIC X(24) VALUE "    X     ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 3: 5,5%
      *-----------------------------------------------------------------
          10    WKB-SHADE-11-20.
      ***  15   FILLER                 PIC X(06) VALUE "060606".
           15   FILLER                 PIC X(06) VALUE "060624".
           15   FILLER1                PIC X(24) VALUE "X         ".
           15   FILLER2                PIC X(24) VALUE "          ".
           15   FILLER3                PIC X(24) VALUE "          ".
           15   FILLER4                PIC X(24) VALUE "   X      ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 4: 12,5% OK
      *-----------------------------------------------------------------
          10    WKB-SHADE-21-35.
           15   FILLER                 PIC X(06) VALUE "040408".
           15   FILLER1                PIC X(24) VALUE "X         ".
           15   FILLER2                PIC X(24) VALUE "          ".
           15   FILLER3                PIC X(24) VALUE "  X       ".
           15   FILLER4                PIC X(24) VALUE "          ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 5: 25% OK
      *-----------------------------------------------------------------
          10    WKB-SHADE-36-55.
           15   FILLER                 PIC X(06) VALUE "020408".
           15   FILLER1                PIC X(24) VALUE "X         ".
           15   FILLER2                PIC X(24) VALUE "  X       ".
           15   FILLER3                PIC X(24) VALUE "          ".
           15   FILLER4                PIC X(24) VALUE "          ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 6: 50%
      *-----------------------------------------------------------------
          10    WKB-SHADE-56-80.
      ***  15   FILLER                 PIC X(06) VALUE "040404".
           15   FILLER                 PIC X(06) VALUE "040408".
           15   FILLER1                PIC X(24) VALUE "XX        ".
           15   FILLER2                PIC X(24) VALUE "XX        ".
           15   FILLER3                PIC X(24) VALUE "  XX      ".
           15   FILLER4                PIC X(24) VALUE "  XX      ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 7: 87,5% OK
      *-----------------------------------------------------------------
          10    WKB-SHADE-81-99.
      **** 15   FILLER                 PIC X(06) VALUE "040808".
           15   FILLER                 PIC X(06) VALUE "040824".
           15   FILLER1                PIC X(24) VALUE "  XXXXXX  ".
           15   FILLER2                PIC X(24) VALUE "  XXXXXX  ".
           15   FILLER3                PIC X(24) VALUE "XXXX  XX  ".
           15   FILLER4                PIC X(24) VALUE "XXXX  XX  ".
           15   FILLER5                PIC X(24) VALUE "          ".
           15   FILLER6                PIC X(24) VALUE "          ".
           15   FILLER7                PIC X(24) VALUE "          ".
           15   FILLER8                PIC X(24) VALUE "          ".
           15   FILLER9                PIC X(24) VALUE "          ".
           15   FILLER10               PIC X(24) VALUE "          ".
           15   FILLER11               PIC X(24) VALUE "          ".
           15   FILLER12               PIC X(24) VALUE "          ".
           15   FILLERX                PIC X(288) VALUE "          ".
      *-----------------------------------------------------------------
      * 8: PLATZHALTER FUER 8
      *-----------------------------------------------------------------
          10    FILLERXXXX             PIC X(582) VALUE "010101    ".
      *-----------------------------------------------------------------
      * 9: CROSS 1 -----
      *-----------------------------------------------------------------
          10    WKB-CROSS-1.
           15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER1                PIC X(24) VALUE "            ".
           15   FILLER2                PIC X(24) VALUE "            ".
           15   FILLER3                PIC X(24) VALUE "            ".
           15   FILLER4                PIC X(24) VALUE "            ".
           15   FILLER5                PIC X(24) VALUE "            ".
           15   FILLER7                PIC X(24) VALUE "            ".
           15   FILLER6                PIC X(24) VALUE ALL "X".
           15   FILLER8                PIC X(24) VALUE "            ".
           15   FILLER9                PIC X(24) VALUE "            ".
           15   FILLER10               PIC X(24) VALUE "            ".
           15   FILLER11               PIC X(24) VALUE "            ".
           15   FILLER12               PIC X(24) VALUE "            ".
           15   FILLERX                PIC X(288) VALUE "           ".
      *-----------------------------------------------------------------
      * 9: CROSS 2 |||||
      *-----------------------------------------------------------------
          10    WKB-CROSS-2.
           15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER1                PIC X(24) VALUE "X           ".
           15   FILLER2                PIC X(24) VALUE "X           ".
           15   FILLER3                PIC X(24) VALUE "X           ".
           15   FILLER4                PIC X(24) VALUE "X           ".
           15   FILLER5                PIC X(24) VALUE "X           ".
           15   FILLER6                PIC X(24) VALUE "X           ".
           15   FILLER7                PIC X(24) VALUE "X           ".
           15   FILLER8                PIC X(24) VALUE "X           ".
           15   FILLER9                PIC X(24) VALUE "X           ".
           15   FILLER10               PIC X(24) VALUE "X           ".
           15   FILLER11               PIC X(24) VALUE "X           ".
           15   FILLER12               PIC X(24) VALUE "X           ".
           15   FILLER13               PIC X(24) VALUE "X           ".
           15   FILLER14               PIC X(24) VALUE "X           ".
           15   FILLER15               PIC X(24) VALUE "X           ".
           15   FILLER16               PIC X(24) VALUE "X           ".
           15   FILLER17               PIC X(24) VALUE "X           ".
           15   FILLER18               PIC X(24) VALUE "X           ".
           15   FILLER19               PIC X(24) VALUE "X           ".
           15   FILLER20               PIC X(24) VALUE "X           ".
           15   FILLER21               PIC X(24) VALUE "X           ".
           15   FILLER22               PIC X(24) VALUE "X           ".
           15   FILLER23               PIC X(24) VALUE "X           ".
           15   FILLER24               PIC X(24) VALUE "X           ".
      *-----------------------------------------------------------------
      * 10: CROSS 3 /////
      *-----------------------------------------------------------------
          10    WKB-CROSS-3.
           15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER1                PIC X(24) VALUE "       X    ".
           15   FILLER2                PIC X(24) VALUE "      X     ".
           15   FILLER3                PIC X(24) VALUE "     X      ".
           15   FILLER4                PIC X(24) VALUE "    X       ".
           15   FILLER5                PIC X(24) VALUE "   X        ".
           15   FILLER6                PIC X(24) VALUE "  X         ".
           15   FILLER7                PIC X(24) VALUE " X          ".
           15   FILLER8                PIC X(24) VALUE "X           ".
           15   FILLER9                PIC X(24) VALUE "            ".
           15   FILLER10               PIC X(24) VALUE "            ".
           15   FILLER11               PIC X(24) VALUE "X           ".
           15   FILLER12               PIC X(24) VALUE "X           ".
           15   FILLER13               PIC X(24) VALUE "X           ".
           15   FILLER14               PIC X(24) VALUE "X           ".
           15   FILLER15               PIC X(24) VALUE "X           ".
           15   FILLER16               PIC X(24) VALUE "X           ".
           15   FILLER17               PIC X(24) VALUE "X           ".
           15   FILLER18               PIC X(24) VALUE "X           ".
           15   FILLER19               PIC X(24) VALUE "X           ".
           15   FILLER20               PIC X(24) VALUE "X           ".
           15   FILLER21               PIC X(24) VALUE "X           ".
           15   FILLER22               PIC X(24) VALUE "X           ".
           15   FILLER23               PIC X(24) VALUE "X           ".
           15   FILLER24               PIC X(24) VALUE "X           ".
      *-----------------------------------------------------------------
      * 11: CROSS 4 \\\\\
      *-----------------------------------------------------------------
          10    WKB-CROSS-4.
           15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER1                PIC X(24) VALUE "X           ".
           15   FILLER2                PIC X(24) VALUE " X          ".
           15   FILLER3                PIC X(24) VALUE "  X         ".
           15   FILLER4                PIC X(24) VALUE "   X        ".
           15   FILLER5                PIC X(24) VALUE "    X       ".
           15   FILLER6                PIC X(24) VALUE "     X      ".
           15   FILLER7                PIC X(24) VALUE "      X     ".
           15   FILLER8                PIC X(24) VALUE "       X    ".
           15   FILLER9                PIC X(24) VALUE "            ".
           15   FILLER10               PIC X(24) VALUE "X           ".
           15   FILLER11               PIC X(24) VALUE "X           ".
           15   FILLER12               PIC X(24) VALUE "X           ".
           15   FILLER13               PIC X(24) VALUE "X           ".
           15   FILLER14               PIC X(24) VALUE "X           ".
           15   FILLER15               PIC X(24) VALUE "X           ".
           15   FILLER16               PIC X(24) VALUE "X           ".
           15   FILLER17               PIC X(24) VALUE "X           ".
           15   FILLER18               PIC X(24) VALUE "X           ".
           15   FILLER19               PIC X(24) VALUE "X           ".
           15   FILLER20               PIC X(24) VALUE "X           ".
           15   FILLER21               PIC X(24) VALUE "X           ".
           15   FILLER22               PIC X(24) VALUE "X           ".
           15   FILLER23               PIC X(24) VALUE "X           ".
           15   FILLER24               PIC X(24) VALUE "X           ".
      *-----------------------------------------------------------------
      * 12: CROSS 5 +++++
      *-----------------------------------------------------------------
          10    WKB-CROSS-5.
           15   FILLER                 PIC X(06) VALUE "080808".
           15   FILLER1                PIC X(24) VALUE "X           ".
           15   FILLER2                PIC X(24) VALUE "X           ".
           15   FILLER3                PIC X(24) VALUE "X           ".
           15   FILLER4                PIC X(24) VALUE "X           ".
           15   FILLER5                PIC X(24) VALUE "XXXXXXXXX   ".
           15   FILLER6                PIC X(24) VALUE "X           ".
           15   FILLER7                PIC X(24) VALUE "X           ".
           15   FILLER8                PIC X(24) VALUE "X           ".
           15   FILLER9                PIC X(24) VALUE "X           ".
           15   FILLER10               PIC X(24) VALUE "            ".
           15   FILLER11               PIC X(24) VALUE "X           ".
           15   FILLER12               PIC X(24) VALUE "X           ".
           15   FILLER13               PIC X(24) VALUE "X           ".
           15   FILLER14               PIC X(24) VALUE "X           ".
           15   FILLER15               PIC X(24) VALUE "X           ".
           15   FILLER16               PIC X(24) VALUE "X           ".
           15   FILLER17               PIC X(24) VALUE "X           ".
           15   FILLER18               PIC X(24) VALUE "X           ".
           15   FILLER19               PIC X(24) VALUE "X           ".
           15   FILLER20               PIC X(24) VALUE "X           ".
           15   FILLER21               PIC X(24) VALUE "X           ".
           15   FILLER22               PIC X(24) VALUE "X           ".
           15   FILLER23               PIC X(24) VALUE "X           ".
           15   FILLER24               PIC X(24) VALUE "X           ".
      *-----------------------------------------------------------------
      * 13: CROSS 6 xxxxx
      *-----------------------------------------------------------------
          10    WKB-CROSS-6.
           15   FILLER                 PIC X(06) VALUE "090909".
           15   FILLER1                PIC X(24) VALUE "X       X   ".
           15   FILLER2                PIC X(24) VALUE " X     X    ".
           15   FILLER3                PIC X(24) VALUE "  X   X     ".
           15   FILLER4                PIC X(24) VALUE "   X X      ".
           15   FILLER5                PIC X(24) VALUE "    X       ".
           15   FILLER6                PIC X(24) VALUE "   X X      ".
           15   FILLER7                PIC X(24) VALUE "  X   X     ".
           15   FILLER8                PIC X(24) VALUE " X     X    ".
           15   FILLER9                PIC X(24) VALUE "X       X   ".
           15   FILLER10               PIC X(24) VALUE "            ".
           15   FILLER11               PIC X(24) VALUE "X           ".
           15   FILLER12               PIC X(24) VALUE "X           ".
           15   FILLER13               PIC X(24) VALUE "X           ".
           15   FILLER14               PIC X(24) VALUE "X           ".
           15   FILLER15               PIC X(24) VALUE "X           ".
           15   FILLER16               PIC X(24) VALUE "X           ".
           15   FILLER17               PIC X(24) VALUE "X           ".
           15   FILLER18               PIC X(24) VALUE "X           ".
           15   FILLER19               PIC X(24) VALUE "X           ".
           15   FILLER20               PIC X(24) VALUE "X           ".
           15   FILLER21               PIC X(24) VALUE "X           ".
           15   FILLER22               PIC X(24) VALUE "X           ".
           15   FILLER23               PIC X(24) VALUE "X           ".
           15   FILLER24               PIC X(24) VALUE "X           ".

          10    FILLERXXXX             PIC X(582) VALUE "          ".

         05     FILLER REDEFINES WKB-SHADES.
          10    WKB-SHADE              OCCURS 15.
           15   WKB-SHADE-Y            PIC 9(02).
           15   WKB-SHADE-X            PIC 9(02).
           15   WKB-SHADE-B            PIC 9(02).
           15   FILLER                 OCCURS 24.
            20  FILLER                 OCCURS 24.
             25 WKB-SHADE-PIXEL        PIC X(01).

         05     WKB-SHADE-HEADER.
          10    FILLER                 PIC X(04) VALUE X"424DF606".
          10    FILLER                 PIC X(06) VALUE ALL X"00".
          10    FILLER                 PIC X(04) VALUE X"36000000".
          10    FILLER                 PIC X(04) VALUE X"28000000".
          10    FILLER                 PIC X(04) VALUE X"18000000".
          10    FILLER                 PIC X(04) VALUE X"18000000".
          10    FILLER                 PIC X(04) VALUE X"01001800".
          10    FILLER                 PIC X(04) VALUE X"00000000".
          10    FILLER                 PIC X(02) VALUE X"C006".
          10    FILLER                 PIC X(18) VALUE ALL X"00".

       01       WKM-MELDUNG.
         05     WKM-2176               PIC 9(04) VALUE 2176.
         05     WKM-8204               PIC 9(04) VALUE 8204.
         05     WKM-WARN-0001          PIC 9(04) VALUE 0001.
         05     WKM-WARN-0002          PIC 9(04) VALUE 0002.
         05     WKM-WARN-0003          PIC 9(04) VALUE 0003.
         05     WKM-WARN-0004          PIC 9(04) VALUE 0004.
         05     WKM-WARN-0005          PIC 9(04) VALUE 0005.
         05     WKM-WARN-0006          PIC 9(04) VALUE 0006.
         05     WKM-WARN-0007          PIC 9(04) VALUE 0007.

       01       I1                     PIC S9(09) COMP-5.
       01       I2-x.
        05      I2                     PIC 9(09) COMP-5.
       01       I3                     PIC S9(09) COMP-5.
       01       I4                     PIC S9(09) COMP-5.
       01       I5                     PIC S9(09) COMP-5.
       01       I-B                    PIC S9(09) COMP-5.
       01       I-BB                   PIC S9(09) COMP-5.
       01       I-BV                   PIC S9(09) COMP-5.
       01       I-C                    PIC S9(09) COMP-5.
       01       I-CB                   PIC S9(09) COMP-5.
       01       I-CHB                  PIC S9(09) COMP-5.
       01       I-CHV                  PIC S9(09) COMP-5.
       01       I-CV                   PIC S9(09) COMP-5.
       01       I-E                    PIC S9(09) COMP-5.
       01       I-EB                   PIC S9(09) COMP-5.
       01       I-ESC                  PIC S9(09) COMP-5.
       01       I-EV                   PIC S9(09) COMP-5.
       01       I-EV1                  PIC S9(09) COMP-5.
       01       I-EV2                  PIC S9(09) COMP-5.
       01       I-EV3                  PIC S9(09) COMP-5.
       01       I-EV4                  PIC S9(09) COMP-5.
       01       I-EV5                  PIC S9(09) COMP-5.
       01       I-FEHL                 PIC S9(09) COMP-5.
       01       I-L                    PIC S9(09) COMP-5.
       01       I-L2                   PIC S9(09) COMP-5.
       01       I-P                    PIC S9(09) COMP-5.
       01       I-S                    PIC S9(09) COMP-5.
       01       I-S2                   PIC S9(09) COMP-5.
       01       I-SH                   PIC S9(09) COMP-5.
       01       I-SX                   PIC S9(09) COMP-5.
       01       I-SY                   PIC S9(09) COMP-5.
       01       I-T                    PIC S9(09) COMP-5.
       01       I-WB                   PIC S9(09) COMP-5.
       01       I-WV                   PIC S9(09) COMP-5.
       01       I-X                    PIC S9(09) COMP-5.
       01       I-Y                    PIC S9(09) COMP-5.

       01       SPS-SCHALTER.
         05     SPS-PROTO              PIC X(01) VALUE " ".
         05     SPS-TEST               PIC X(01) VALUE " ".
         05     SPS-TEST2              PIC X(01).
         05     SPS-STATUS             PIC X(01).
         05     SPS-OPEN-IN            PIC X(01).
         05     SPS-LESEN              PIC X(01).
         05     SPS-DATA               PIC X(01).
         05     SPS-DATA-GES           PIC X(01).
         05     SPS-POSI-Y             PIC X(01).
         05     SPS-PITCH              PIC X(01).
         05     SPS-HEIGHT             PIC X(01).
         05     SPS-GROESSE-MIST       PIC X(01).
         05     SPS-ESC-TYP            PIC X(01).
           88   SPS-ESC-RASTER-DATA    VALUE "1".
           88   SPS-ESC-MARGINS        VALUE "2".
           88   SPS-ESC-LINES          VALUE "3".
           88   SPS-ESC-POSI           VALUE "4".
           88   SPS-ESC-RASTER         VALUE "5".
           88   SPS-ESC-RESOL          VALUE "6".
           88   SPS-ESC-FONT           VALUE "7".
           88   SPS-ESC-RESET          VALUE "8".
           88   SPS-ESC-RECT           VALUE "9".
           88   SPS-ESC-HMI            VALUE "A".
           88   SPS-ESC-FILLR          VALUE "B".
           88   SPS-ESC-CLEARM         VALUE "C".
           88   SPS-ESC-PUSHPOP        VALUE "D".
           88   SPS-ESC-MAKRO          VALUE "E".
           88   SPS-ESC-PATTERN        VALUE "F".
           88   SPS-ESC-PARSING        VALUE "G".

       01       SPH-FELDER.
         05     SPH-TITLE              PIC X(64) VALUE SPACE .
         05     SPH-CLASSNAME          PIC X(64) VALUE SPACE .
         05     SPH-CLASSNAME2         PIC X(64) VALUE SPACE .
         05     SPH-TCPPL.
          10    SPH-TCX                PIC 9(9) COMP-5.
          10    SPH-TCY                PIC 9(9) COMP-5.
         05     SPH-Z10-A.
          10    SPH-Z10                PIC -(09)9.
         05     SPH-Z6-A.
          10    SPH-Z6                 PIC -(05)9.
         05     SPH-NUM1-A.
          10    SPH-NUM1               PIC 9(01).
         05     SPH-NUM2-A.
          10    SPH-NUM2               PIC 9(02).
         05     SPH-N5-A.
          10    SPH-N5                 PIC 9(05).
         05     SPH-N4-A.
          10    SPH-N4                 PIC 9(04).
         05     SPH-N3-A.
          10    SPH-N3                 PIC 9(03).
         05     SPH-N2-A.
          10    SPH-N2                 PIC 9(02).
         05     SPH-N1-A.
          10    SPH-N1                 PIC 9(01).
         05     SPH-A1-A.
          10    SPH-A1                 PIC 9(02) BINARY.
         05     SPH-B1-A.
          10    SPH-B1                 PIC 9(02) BINARY.
         05     SPH-C1-A.
          10    SPH-C1                 PIC 9(02) BINARY.
         05     SPH-X8.
          10    SPH-X8-B               OCCURS 8
                                       PIC 9(01).
         05     SPH-Y8.
          10    SPH-Y8-B               OCCURS 8
                                       PIC 9(01).
         05     SPH-Z8.
          10    SPH-Z8-B               OCCURS 8
                                       PIC 9(01).
         05     SPH-RC                 PIC S9(09) COMP-5.
         05     SPH-ORIENTATION        PIC S9(01).
         05     SPH-ROTATION           PIC S9(01).
         05     SPH-PAGESIZE           PIC S9(04) COMP-5.
         05     SPH-RESOLUTION         PIC S9(04) COMP-5.
         05     SPH-SEITE              PIC S9(09) COMP-5.
         05     SPH-DIVISOR            PIC S9(09) COMP-5.
         05     SPH-HEIGHT             PIC S9(07)V99 COMP-5.
         05     SPH-PITCH              PIC S9(07)V99 COMP-5.
         05     SPH-POTENZ             PIC S9(09) COMP-5.
         05     SPH-X-SEITE-B          PIC S9(09) COMP-5.
         05     SPH-X-SEITE-V          PIC S9(09) COMP-5.
         05     SPH-Y-SEITE-B          PIC S9(09) COMP-5.
         05     SPH-Y-SEITE-V          PIC S9(09) COMP-5.
         05     SPH-Y-DIFF             PIC S9(09) COMP-5.
         05     SPH-X-DIFF             PIC S9(09) COMP-5.
         05     SPH-WERT               PIC S9(09) COMP-5.
         05     SPH-VMI                PIC S9(09) COMP-5.
         05     SPH-HMI                PIC S9(09) COMP-5.
         05     SPH-AKT-PATTERN        PIC S9(09) COMP-5.
         05     SPH-RECT-Y             PIC S9(09) COMP-5.
         05     SPH-RECT-X             PIC S9(09) COMP-5.
         05     SPH-RECT-FILL          PIC S9(09) COMP-5.
         05     SPH-RECT-SHADE         PIC S9(09) COMP-5.
         05     SPH-PAGE-Y             PIC S9(09) COMP-5.
         05     SPH-PAGE-X             PIC S9(09) COMP-5.
         05     SPH-START-Y            PIC S9(09) COMP-5.
         05     SPH-START-X            PIC S9(09) COMP-5.
         05     SPH-MARGIN-Y           PIC S9(09) COMP-5.
         05     SPH-MARGIN-X           PIC S9(09) COMP-5.
         05     SPH-MIN-Y              PIC S9(09) COMP-5.
         05     SPH-TEXT-Y             PIC S9(09) COMP-5.
         05     SPH-SC-Y               PIC S9(09) COMP-5.
         05     SPH-SC-X               PIC S9(09) COMP-5.
         05     SPH-RASTER-X           PIC S9(09) COMP-5.
         05     SPH-RASTER-PIXEL       PIC S9(09) COMP-5.
         05     SPH-W-X                PIC S9(09) COMP-5.
         05     SPH-W-Y                PIC S9(09) COMP-5.
         05     SPH-X                  PIC S9(09) COMP-5.
         05     SPH-X2                 PIC S9(09) COMP-5.
         05     SPH-Y                  PIC S9(09) COMP-5.
         05     SPH-Y2                 PIC S9(09) COMP-5.
         05     SPH-PROC               PIC X(64).
         05     SPH-LIB                PIC X(64).
         05     SPH-ACC                PIC X(256).
         05     SPH-LWT                PIC X(02).
         05     SPH-TT                 PIC X(128).
         05     SPH-DRIVER             PIC X(32).
         05     SPH-MNR                PIC X(04).
         05     SPH-MPAR1              PIC X(40).
         05     SPH-MPAR2              PIC X(40).
         05     SPH-MPAR3              PIC X(80).
         05     SPH-PRAEFIX            PIC X(16).
         05     SPH-PRAEFIXL           PIC 9(04) COMP-5.
         05     SPH-EM                 PIC 9(01)V9(03) COMP-5.
         05     SPH-EMF                PIC 9(01)V9(03) COMP-5.
         05     SPH-END                PIC X(01).
         05     SPH-DEVMODE            PIC X(512).
         05     SPH-DEVNAMES           PIC X(08).
         05     SPH-PRINTER            PIC X(256).
         05     SPH-PRINTER2           PIC X(256).
         05     SPH-TEXT               PIC X(4096).
         05     SPH-TEXT2              PIC X(4096).
         05     SPH-TEXT-UTF           PIC X(4096).
         05     SPH-DATEI              PIC X(32).
         05     SPH-FONT               PIC X(04) COMP-5.
         05     SPH-FONTX              PIC X(04) COMP-5.
         05     SPH-HWND-PRINTER       PIC S9(INT-NUM) COMP-5.
         05     SPH-POINTER-N          PIC S9(INT-NUM) COMP-5.
         05     FILLER REDEFINES SPH-POINTER-N.
          10    SPH-POINTER            POINTER.
         05     SPH-PRINTJOB           PIC S9(INT-NUM) COMP-5.
         05     SPH-X32.
          10    SPH-B32  OCCURS 32     PIC 9(01).
         05     SPH-P-X                PIC S9(09) COMP-5.
         05     SPH-P-Y                PIC S9(09) COMP-5.
         05     SPH-2X                 PIC S9(09) COMP-5.
         05     SPH-2Y                 PIC S9(09) COMP-5.
         05     SPH-P-XR               PIC S9(09) COMP-5.
         05     SPH-P-YR               PIC S9(09) COMP-5.
         05     SPH-VOR                PIC S9(09) COMP-5.
         05     SPH-RES-X              PIC S9(09) COMP-5.
         05     SPH-RES-Y              PIC S9(09) COMP-5.
         05     SPH-FONT-X             PIC S9(09) COMP-5.
         05     SPH-FONT-O-X           PIC S9(09) COMP-5.
         05     SPH-LPIX-X             PIC S9(09) COMP-5.
         05     SPH-COL-BLACK          PIC S9(09) COMP-5.
         05     SPH-COL-WHITE          PIC S9(09) COMP-5.
         05     SPH-COL                PIC S9(09) COMP-5.
         05     FILLER REDEFINES SPH-COL.
          10    SPH-COL-R              PIC 9(02) COMP.
          10    SPH-COL-G              PIC 9(02) COMP.
          10    SPH-COL-B              PIC 9(02) COMP.
          10    SPH-COL-0              PIC 9(02) COMP.
         05     SPH-COL2               PIC S9(09) COMP-5.
         05     FILLER REDEFINES SPH-COL2.
          10    SPH-COL2-R             PIC 9(02) COMP.
          10    SPH-COL2-G             PIC 9(02) COMP.
          10    SPH-COL2-B             PIC 9(02) COMP.
          10    SPH-COL2-0             PIC 9(02) COMP.
         05     SPH-BRUSH-TAB.
          10    SPH-SHADE-HBMP         OCCURS 14
                                       PIC S9(09) COMP-5.
          10    SPH-SHADEI-HBMP        OCCURS 14
                                       PIC S9(09) COMP-5.
          10    SPH-BRUSH-SHADE        OCCURS 14
                                       PIC S9(09) COMP-5.
          10    SPH-BRUSH-SHADEI       OCCURS 14
                                       PIC S9(09) COMP-5.
          10    SPH-BRUSH-BLACK        PIC S9(09) COMP-5.
          10    SPH-BRUSH-WHITE        PIC S9(09) COMP-5.
          10    SPH-BRUSH              PIC S9(09) COMP-5.
          10    SPH-BRUSHI             PIC S9(09) COMP-5.
         05     SPH-PUSH-TAB.
          10    SPH-PUSH-AKT           PIC S9(04) COMP-5.
          10    FILLER                 OCCURS 20.
           15   SPH-PUSH-X             PIC S9(09) COMP-5.
           15   SPH-PUSH-Y             PIC S9(09) COMP-5.
           15   SPH-PUSH-TX            PIC S9(09) COMP-5.
           15   SPH-PUSH-TY            PIC S9(09) COMP-5.
           15   SPH-PUSH-TEXT-Y        PIC S9(09) COMP-5.
         05     SPH-HDC                PIC S9(INT-NUM) COMP-5.
         05     SPH-HDCX               PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC0               PIC S9(INT-NUM) COMP-5.
         05     SPH-HDCW               PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-PRN            PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPI          PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMP1          PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPW1         PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPW2         PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPW3         PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPW4         PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMP2          PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMP3          PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMP4          PIC S9(INT-NUM) COMP-5.
         05     SPH-HDC-COMPS          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPI          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPW1         PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPW2         PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPW3         PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPW4         PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMP1          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMP2          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMP3          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMP4          PIC S9(INT-NUM) COMP-5.
         05     SPH-BMP-COMPS          PIC S9(INT-NUM) COMP-5.
         05     SPH-DEF-WEIGHT         PIC S9(09) COMP-5.
         05     SPH-DEF-PITCHANDFAMILY PIC S9(04) COMP-5.
         05     SPH-PITCHANDFAMILY     PIC S9(04) COMP-5.
         05     SPH-DEF-FACENAME       PIC X(32).
         05     SPH-TTOP               PIC S9(09) COMP-5.
         05     SPH-TLEFT              PIC S9(09) COMP-5.
         05     SPH-XTOP               PIC S9(09) COMP-5.
         05     SPH-XLEFT              PIC S9(09) COMP-5.
         05     SPH-MSIMG-TRABLT-N     PIC 9(INT-NUM) COMP-5.
         05     FILLER REDEFINES SPH-MSIMG-TRABLT-N .
          10    SPH-MSIMG-TRABLT-P     PROCEDURE-POINTER.
         05     SPH-HMODULE-MSIMG      PIC 9(INT-NUM) COMP-5.
         05     SPH-CODEPAGE           PIC 9(009) COMP-5.
         05     SPH-CODEPAGE-LAST      PIC 9(009) COMP-5.
         05     SPH-CODEPAGE-OLD       PIC 9(009) COMP-5.
         05     SPH-MYENUMPROC1        PROCEDURE-POINTER.

         05     SPH-2RECT.
          10    SPH-2LEFT              PIC S9(09) COMP-5.
          10    SPH-2TOP               PIC S9(09) COMP-5.
          10    SPH-2RIGHT             PIC S9(09) COMP-5.
          10    SPH-2BOTTOM            PIC S9(09) COMP-5.
         05     SPH-3RECT.
          10    SPH-3LEFT              PIC S9(09) COMP-5.
          10    SPH-3TOP               PIC S9(09) COMP-5.
          10    SPH-3RIGHT             PIC S9(09) COMP-5.
          10    SPH-3BOTTOM            PIC S9(09) COMP-5.
         05     SPH-4RECT.
          10    SPH-4LEFT              PIC S9(09) COMP-5.
          10    SPH-4TOP               PIC S9(09) COMP-5.
          10    SPH-4RIGHT             PIC S9(09) COMP-5.
          10    SPH-4BOTTOM            PIC S9(09) COMP-5.


         05     SPH-ESC-TAB.
          10    SPH-ESC-ANZ            PIC 9(04) COMP-5.
          10    SPH-ESC-TAB2.
           15   FILLER OCCURS 64.
            20  SPH-ESC1.
             25 SPH-ESC1N              PIC S9(08)
                                           SIGN TRAILING SEPARATE.
             25 SPH-ESC1D REDEFINES SPH-ESC1N
                                       PIC S9(05)V9(03)
                                           SIGN TRAILING SEPARATE.
            20  SPH-ESC2               PIC X(08).
            20  SPH-ESC3               PIC X(08).
            20  SPH-ESCV               PIC X(01).

         05     SPH-LOGFONT.
          10    SPH-LFHEIGHT           PIC S9(9) COMP-5.
          10    SPH-LFWIDTH            PIC S9(9) COMP-5.
          10    SPH-LFESCAPEMENT       PIC S9(9) COMP-5.
          10    SPH-LFORIENTATION      PIC S9(9) COMP-5.
          10    SPH-LFWEIGHT           PIC S9(9) COMP-5.
          10    SPH-LFITALIC           PIC X COMP-X.
          10    SPH-LFUNDERLINE        PIC X COMP-X.
          10    SPH-LFSTRIKEOUT        PIC X COMP-X.
          10    SPH-LFCHARSET          PIC X COMP-X.
          10    SPH-LFOUTPRECISION     PIC X COMP-X.
          10    SPH-LFCLIPPRECISION    PIC X COMP-X.
          10    SPH-LFQUALITY          PIC X COMP-X.
          10    SPH-LFPITCHANDFAMILY   PIC X COMP-X.
          10    SPH-LFFACENAME         PIC X(32).

         05     SPH-2LOGFONT.
          10    SPH-2LFHEIGHT          PIC S9(9) COMP-5.
          10    SPH-2LFWIDTH           PIC S9(9) COMP-5.
          10    SPH-2LFESCAPEMENT      PIC S9(9) COMP-5.
          10    SPH-2LFORIENTATION     PIC S9(9) COMP-5.
          10    SPH-2LFWEIGHT          PIC S9(9) COMP-5.
          10    SPH-2LFITALIC          PIC X COMP-X.
          10    SPH-2LFUNDERLINE       PIC X COMP-X.
          10    SPH-2LFSTRIKEOUT       PIC X COMP-X.
          10    SPH-2LFCHARSET         PIC X COMP-X.
          10    SPH-2LFOUTPRECISION    PIC X COMP-X.
          10    SPH-2LFCLIPPRECISION   PIC X COMP-X.
          10    SPH-2LFQUALITY         PIC X COMP-X.
          10    SPH-2LFPITCHANDFAMILY  PIC X COMP-X.
          10    SPH-2LFFACENAME        PIC X(32).

         05     SPH-3LOGFONT-PTR       POINTER.
         05     SPH-3LOGFONT.
          10    SPH-3LFHEIGHT          PIC S9(9) COMP-5.
          10    SPH-3LFWIDTH           PIC S9(9) COMP-5.
          10    SPH-3LFESCAPEMENT      PIC S9(9) COMP-5.
          10    SPH-3LFORIENTATION     PIC S9(9) COMP-5.
          10    SPH-3LFWEIGHT          PIC S9(9) COMP-5.
          10    SPH-3LFITALIC          PIC X COMP-X.
          10    SPH-3LFUNDERLINE       PIC X COMP-X.
          10    SPH-3LFSTRIKEOUT       PIC X COMP-X.
          10    SPH-3LFCHARSET         PIC X COMP-X.
          10    SPH-3LFOUTPRECISION    PIC X COMP-X.
          10    SPH-3LFCLIPPRECISION   PIC X COMP-X.
          10    SPH-3LFQUALITY         PIC X COMP-X.
          10    SPH-3LFPITCHANDFAMILY  PIC X COMP-X.
          10    SPH-3LFFACENAME        PIC X(32).

         05     SPH-TEXTMETRIC.
           10   SPH-TM-LFHEIGHT        PIC S9(9) COMP-5.
           10   SPH-TM-ASCENT          PIC S9(9) COMP-5.
           10   SPH-TM-DESCENT         PIC S9(9) COMP-5.
           10   SPH-TM-INTLEAD         PIC S9(9) COMP-5.
           10   SPH-TM-EXTLEAD         PIC S9(9) COMP-5.
           10   SPH-TM-AVECHARWIDTH    PIC S9(9) COMP-5.
           10   SPH-TM-MAXCHARWIDTH    PIC S9(9) COMP-5.
           10   SPH-TM-WEIGHT          PIC S9(9) COMP-5.
           10   SPH-TM-OVERHANG        PIC S9(9) COMP-5.
           10   SPH-TM-DIGASPECTX      PIC S9(9) COMP-5.
           10   SPH-TM-DIGASPECTY      PIC S9(9) COMP-5.
           10   SPH-TM-CHARS           PIC X(4).
           10   SPH-TM-BYTES           PIC X(32).

       01       SPH-SATZ               PIC X(262144).

       01       DOCINFO.
         05     DI-STRUCTSIZE          PIC 9(09) COMP-5.
         05     DI-LPSZ-DOCNAME        POINTER.
         05     DI-LPSZ-OUTPUT         POINTER.
         05     DI-DATATYPE            PIC 9(09) COMP-5.
         05     DI-FWTYPE              PIC 9(09) COMP-5.
       01       DI-DOCNAME             PIC X(20)
                                       VALUE "IntexPCL2Pr" & X"00".
       01       DI-OUTPUT              PIC X(255).

       01       PRINTDLG64.
         05     PD64-STRUCTSIZE          PIC 9(INT-NUM) COMP-5.
         05     PD64-HWND                POINTER.
         05     PD64-DEVMODE-A.
          10    PD64-DEVMODE             POINTER.
         05     PD64-DEVNAMES-A.
          10    PD64-DEVNAMES            POINTER.
         05     PD64-HDC                 PIC 9(INT-NUM) COMP-5.
         05     PD64-FLAGS               PIC 9(09) COMP-5.
         05     PD64-FROMPAGE            PIC 9(04) COMP-5.
         05     PD64-TOPAGE              PIC 9(04) COMP-5.
         05     PD64-MINPAGE             PIC 9(04) COMP-5.
         05     PD64-MAXPAGE             PIC 9(04) COMP-5.
         05     PD64-COPIES              PIC 9(04) COMP-5.
         05     FILLER1                  PIC X(02).
         05     PD64-HINSTANCE           POINTER.
         05     PD64-LCUSTDATA           PIC S9(09) COMP-5.
         05     PD64-LPFN-PRINTHOOK      PROCEDURE-POINTER.
         05     PD64-LPFN-SETUPHOOK      PROCEDURE-POINTER.
         05     FILLER2                  PIC X(04).
         05     PD64-LP-PRINTTEMPLATENAME POINTER.
         05     PD64-LP-SETUPTEMPLATENAME POINTER.
         05     PD64-HPRINTTEMPLATE      POINTER.
         05     PD64-HSETUPTEMPLATE      POINTER.

       01       PRINTDLG32.
         05     PD32-STRUCTSIZE          PIC 9(INT-NUM) COMP-5.
         05     PD32-HWND                POINTER.
         05     PD32-DEVMODE-A.
          10    PD32-DEVMODE             POINTER.
         05     PD32-DEVNAMES-A.
          10    PD32-DEVNAMES            POINTER.
         05     PD32-HDC                 PIC 9(INT-NUM) COMP-5.
         05     PD32-FLAGS               PIC 9(09) COMP-5.
         05     PD32-FROMPAGE            PIC 9(04) COMP-5.
         05     PD32-TOPAGE              PIC 9(04) COMP-5.
         05     PD32-MINPAGE             PIC 9(04) COMP-5.
         05     PD32-MAXPAGE             PIC 9(04) COMP-5.
         05     PD32-COPIES              PIC 9(04) COMP-5.
         05     PD32-HINSTANCE           POINTER.
         05     PD32-LCUSTDATA           PIC S9(09) COMP-5.
         05     PD32-LPFN-PRINTHOOK      PROCEDURE-POINTER.
         05     PD32-LPFN-SETUPHOOK      PROCEDURE-POINTER.
         05     PD32-LP-PRINTTEMPLATENAME POINTER.
         05     PD32-LP-SETUPTEMPLATENAME POINTER.
         05     PD32-HPRINTTEMPLATE      POINTER.
         05     PD32-HSETUPTEMPLATE      POINTER.

       01       PD-DEVMODE-X.
          10    PD-DEVMODE-N           PIC 9(INT-NUM) COMP-5.
       01       PD-DEVNAMES-X.
          10    PD-DEVNAMES-N          PIC 9(INT-NUM) COMP-5.

       01       DEVMODE2.
         05     DM2DEVICENAME          PIC X(32).
         05     DM2SPECVERSION         PIC 9(04) COMP-5.
         05     DM2DRIVERVERSION       PIC 9(04) COMP-5.
         05     DM2SIZE                PIC 9(04) COMP-5.
         05     DM2DRIVEREXTRA         PIC 9(04) COMP-5.
         05     DM2FIELDS              PIC 9(09) COMP-5.
         05     DM2ORIENTATION         PIC S9(04) COMP-5.
         05     DM2PAPERSIZE           PIC S9(04) COMP-5.
         05     DM2PAPERLENGTH         PIC S9(04) COMP-5.
         05     DM2PAPERWIDTH          PIC S9(04) COMP-5.
         05     DM2SCALE               PIC S9(04) COMP-5.
         05     DM2COPIES              PIC S9(04) COMP-5.
         05     DM2DEFAULTSOURCE       PIC S9(04) COMP-5.
         05     DM2PRINTQUALITY        PIC S9(04) COMP-5.
         05     DM2COLOR               PIC S9(04) COMP-5.
         05     DM2DUPLEX              PIC S9(04) COMP-5.
         05     DM2YRESOLUTION         PIC S9(04) COMP-5.
         05     DM2TTOPTION            PIC S9(04) COMP-5.
         05     DM2COLLATE             PIC S9(04) COMP-5.
         05     DM2FORMNAME            PIC X(32).
         05     DM2LOGPIXELS           PIC 9(04) COMP-5.
         05     DM2BITSPERPEL          PIC 9(09) COMP-5.
         05     DM2PELSWIDTH           PIC 9(09) COMP-5.
         05     DM2PELSHEIGHT          PIC 9(09) COMP-5.
         05     DM2DISPLAYFLAGS        PIC 9(09) COMP-5.
         05     DM2DISPLAYFREQUENCY    PIC 9(09) COMP-5.
         05     DM2ICMMETHOD           PIC 9(09) COMP-5.
         05     DM2ICMINTENT           PIC 9(09) COMP-5.
         05     DM2MEDIATYPE           PIC 9(09) COMP-5.
         05     DM2DITHERTYPE          PIC 9(09) COMP-5.
         05     DM2ICCMANUFACTURER     PIC 9(09) COMP-5.
         05     DM2ICCMODEL            PIC 9(09) COMP-5.
         05     DM2PANNINGWIDTH        PIC 9(09) COMP-5.
         05     DM2PANNINGHEIGHT       PIC 9(09) COMP-5.
         05     DM2FILLER              PIC X(32000).

       01       DEVMODE3.
         05     DM3DEVICENAME          PIC X(32).
         05     DM3SPECVERSION         PIC 9(04) COMP-5.
         05     DM3DRIVERVERSION       PIC 9(04) COMP-5.
         05     DM3SIZE                PIC 9(04) COMP-5.
         05     DM3DRIVEREXTRA         PIC 9(04) COMP-5.
         05     DM3FIELDS              PIC 9(09) COMP-5.
         05     DM3ORIENTATION         PIC S9(04) COMP-5.
         05     DM3PAPERSIZE           PIC S9(04) COMP-5.
         05     DM3PAPERLENGTH         PIC S9(04) COMP-5.
         05     DM3PAPERWIDTH          PIC S9(04) COMP-5.
         05     DM3SCALE               PIC S9(04) COMP-5.
         05     DM3COPIES              PIC S9(04) COMP-5.
         05     DM3DEFAULTSOURCE       PIC S9(04) COMP-5.
         05     DM3PRINTQUALITY        PIC S9(04) COMP-5.
         05     DM3COLOR               PIC S9(04) COMP-5.
         05     DM3DUPLEX              PIC S9(04) COMP-5.
         05     DM3YRESOLUTION         PIC S9(04) COMP-5.
         05     DM3TTOPTION            PIC S9(04) COMP-5.
         05     DM3COLLATE             PIC S9(04) COMP-5.
         05     DM3FORMNAME            PIC X(32).
         05     DM3LOGPIXELS           PIC 9(04) COMP-5.
         05     DM3BITSPERPEL          PIC 9(09) COMP-5.
         05     DM3PELSWIDTH           PIC 9(09) COMP-5.
         05     DM3PELSHEIGHT          PIC 9(09) COMP-5.
         05     DM3DISPLAYFLAGS        PIC 9(09) COMP-5.
         05     DM3DISPLAYFREQUENCY    PIC 9(09) COMP-5.
         05     DM3ICMMETHOD           PIC 9(09) COMP-5.
         05     DM3ICMINTENT           PIC 9(09) COMP-5.
         05     DM3MEDIATYPE           PIC 9(09) COMP-5.
         05     DM3DITHERTYPE          PIC 9(09) COMP-5.
         05     DM3ICCMANUFACTURER     PIC 9(09) COMP-5.
         05     DM3ICCMODEL            PIC 9(09) COMP-5.
         05     DM3PANNINGWIDTH        PIC 9(09) COMP-5.
         05     DM3PANNINGHEIGHT       PIC 9(09) COMP-5.
         05     DM3FILLER              PIC X(32000).

       01       WNDCLASS32.
        03      WND32-STYLE              PIC 9(09) COMP-5.
        03      WND32-LPFNWNDPROC        PROCEDURE-POINTER.
        03      WND32-CBCLSEXTRA         PIC S9(09) COMP-5.
        03      WND32-CBWNDEXTRA         PIC S9(09) COMP-5.
        03      WND32-HINSTANCE          POINTER.
        03      WND32-HICON              POINTER.
        03      WND32-HCURSOR            POINTER.
        03      WND32-HBRBACKGROUND      POINTER.
        03      WND32-LPSZMENUNAME       POINTER.
        03      WND32-LPSZCLASSNAME      POINTER.

       01       WNDCLASS64.
        03      WND64-STYLE              PIC 9(09) COMP-5.
        03      WND64-LPFNWNDPROC        PROCEDURE-POINTER.
        03      WND64-CBCLSEXTRA         PIC S9(09) COMP-5.
        03      WND64-CBWNDEXTRA         PIC S9(09) COMP-5.
        03      FILLER3                  PIC X(04).
        03      WND64-HINSTANCE          POINTER.
        03      WND64-HICON              POINTER.
        03      WND64-HCURSOR            POINTER.
        03      WND64-HBRBACKGROUND      POINTER.
        03      WND64-LPSZMENUNAME       POINTER.
        03      WND64-LPSZCLASSNAME      POINTER.

       01       BITMAPINFO.
        02      BITMAPINFOHEADER.
         05     BISIZE                 PIC 9(09) COMP-5.
         05     BIWIDTH                PIC S9(09) COMP-5.
         05     BIHEIGHT               PIC S9(09) COMP-5.
         05     BIPLANES               PIC 9(04) COMP-5.
         05     BIBITCOUNT             PIC 9(04) COMP-5.
         05     BICOMPRESSION          PIC 9(09) COMP-5.
         05     BISIZEIMAGE            PIC 9(09) COMP-5.
         05     BIXPELSPERMETER        PIC S9(09) COMP-5.
         05     BIYPELSPERMETER        PIC S9(09) COMP-5.
         05     BICLRUSED              PIC 9(09) COMP-5.
         05     BICLRIMPORTANT         PIC 9(09) COMP-5.
        02      RGBQUADS               PIC X(12).

       01       BIGBUFF1               PIC X(80000000).
       01       BIGBUFF2               PIC X(80000000).
       01       BIGBUFF3               PIC X(80000000).

       01       HINST                  POINTER.
       01       HPREVINSTANCE          PIC S9(INT-NUM) COMP-5.
       01       NCMDSHOW               PIC S9(INT-NUM) COMP-5.
       01       LPSZCMDLINE            PIC X(256).

        01      INITCTRL.
         05     ICTRL-SIZE             PIC S9(09) COMP-5 VALUE 8.
         05     ICTRL-ICC              PIC S9(09) COMP-5 VALUE 4.

      ******************************************************************
      *
       LOCAL-STORAGE SECTION.
      *
      ******************************************************************

       01      WORK-LOCAL-DATA.
        03     LONGRESULT              PIC X(4) COMP-5.
        03     HWINDOW                 PIC S9(INT-NUM) COMP-5.


      ******************************************************************
      *
       LINKAGE SECTION.
      *
      ******************************************************************
       01       IMESSAGE               PIC 9(4) COMP-5.
       01       WPARAM                 PIC 9(9) COMP-5.
       01       LPARAM                 PIC S9(9) COMP-5.
       01       HWND                   PIC S9(INT-NUM) COMP-5.

       01       DEVMODE.
         05     DMDEVICENAME           PIC X(32).
         05     DMSPECVERSION          PIC 9(04) COMP-5.
         05     DMDRIVERVERSION        PIC 9(04) COMP-5.
         05     DMSIZE                 PIC 9(04) COMP-5.
         05     DMDRIVEREXTRA          PIC 9(04) COMP-5.
         05     DMFIELDS               PIC 9(09) COMP-5.
         05     DMORIENTATION          PIC S9(04) COMP-5.
         05     DMPAPERSIZE            PIC S9(04) COMP-5.
         05     DMPAPERLENGTH          PIC S9(04) COMP-5.
         05     DMPAPERWIDTH           PIC S9(04) COMP-5.
         05     DMSCALE                PIC S9(04) COMP-5.
         05     DMCOPIES               PIC S9(04) COMP-5.
         05     DMDEFAULTSOURCE        PIC S9(04) COMP-5.
         05     DMPRINTQUALITY         PIC S9(04) COMP-5.
         05     DMCOLOR                PIC S9(04) COMP-5.
         05     DMDUPLEX               PIC S9(04) COMP-5.
         05     DMYRESOLUTION          PIC S9(04) COMP-5.
         05     DMTTOPTION             PIC S9(04) COMP-5.
         05     DMCOLLATE              PIC S9(04) COMP-5.
         05     DMFORMNAME             PIC X(32).
         05     DMLOGPIXELS            PIC 9(04) COMP-5.
         05     DMBITSPERPEL           PIC 9(09) COMP-5.
         05     DMPELSWIDTH            PIC 9(09) COMP-5.
         05     DMPELSHEIGHT           PIC 9(09) COMP-5.
         05     DMDISPLAYFLAGS         PIC 9(09) COMP-5.
         05     DMDISPLAYFREQUENCY     PIC 9(09) COMP-5.
         05     DMICMMETHOD            PIC 9(09) COMP-5.
         05     DMICMINTENT            PIC 9(09) COMP-5.
         05     DMMEDIATYPE            PIC 9(09) COMP-5.
         05     DMDITHERTYPE           PIC 9(09) COMP-5.
         05     DMICCMANUFACTURER      PIC 9(09) COMP-5.
         05     DMICCMODEL             PIC 9(09) COMP-5.
         05     DMPANNINGWIDTH         PIC 9(09) COMP-5.
         05     DMPANNINGHEIGHT        PIC 9(09) COMP-5.
         05     DMFILLER               PIC X(32000).

       01       DEVNAMES.
         05     WDRIVEROFFSET          PIC 9(04) COMP-5.
         05     WDEVICEOFFSET          PIC 9(04) COMP-5.
         05     WOUTPUTOFFSET          PIC 9(04) COMP-5.
         05     WDEFAULT               PIC 9(04) COMP-5.
         05     CHDEVNAMES             PIC X(1024).

       01       SPH-LPARAM             PIC 9(009) COMP-5.
       01       SPH-FONTTYPE           PIC 9(009) COMP-5.
       01       SPH-LPNTME             PIC X(512).
       01       SPH-LPELFE             PIC X(512).
       01       SPH-DATA               PIC X(512).


       01  VERSTAENDIGUNGSBEREICH.
           COPY YPCL2PR.
      /
       01  ARBEITSBEREICH.
        02 ARBEITSBER               PIC X(2000).
      /
           COPY DBFELDER.

       01       LNK-LOGFONT.
          10    LNK-LFHEIGHT           PIC S9(9) COMP-5.
          10    LNK-LFWIDTH            PIC S9(9) COMP-5.
          10    LNK-LFESCAPEMENT       PIC S9(9) COMP-5.
          10    LNK-LFORIENTATION      PIC S9(9) COMP-5.
          10    LNK-LFWEIGHT           PIC S9(9) COMP-5.
          10    LNK-LFITALIC           PIC X COMP-X.
          10    LNK-LFUNDERLINE        PIC X COMP-X.
          10    LNK-LFSTRIKEOUT        PIC X COMP-X.
          10    LNK-LFCHARSET          PIC X COMP-X.
          10    LNK-LFOUTPRECISION     PIC X COMP-X.
          10    LNK-LFCLIPPRECISION    PIC X COMP-X.
          10    LNK-LFQUALITY          PIC X COMP-X.
          10    LNK-LFPITCHANDFAMILY   PIC X COMP-X.
          10    LNK-LFFACENAME         PIC X(32).

       01       LNK-TEXTMETRIC.
           10   LNK-TM-LFHEIGHT        PIC S9(9) COMP-5.
           10   LNK-TM-ASCENT          PIC S9(9) COMP-5.
           10   LNK-TM-DESCENT         PIC S9(9) COMP-5.
           10   LNK-TM-INTLEAD         PIC S9(9) COMP-5.
           10   LNK-TM-EXTLEAD         PIC S9(9) COMP-5.
           10   LNK-TM-AVECHARWIDTH    PIC S9(9) COMP-5.
           10   LNK-TM-MAXCHARWIDTH    PIC S9(9) COMP-5.
           10   LNK-TM-WEIGHT          PIC S9(9) COMP-5.
           10   LNK-TM-OVERHANG        PIC S9(9) COMP-5.
           10   LNK-TM-DIGASPECTX      PIC S9(9) COMP-5.
           10   LNK-TM-DIGASPECTY      PIC S9(9) COMP-5.
           10   LNK-TM-CHARS           PIC X(4).
           10   LNK-TM-BYTES           PIC X(32).

       01       LNK-DWTYPE             PIC S9(09) COMP-5.

       01       LNK-DATA               PIC X(1024).

      ******************************************************************
      *
       PROCEDURE DIVISION           USING VERSTAENDIGUNGSBEREICH
                                          ARBEITSBEREICH
                                          DB-FELDER.
      *
      ******************************************************************

       STEUERUNG  SECTION.
      ******************************************************************
      *
      ******************************************************************
       ST-10.
           CALL "PC_WIN_INIT" USING      HINST
                                         HPREVINSTANCE
                                         BY REFERENCE LPSZCMDLINE
                                         NCMDSHOW.

           PERFORM A-INIT.

           IF
                SPS-STATUS                      = SPACE
                EVALUATE TRUE
                    WHEN YPCL2PR-FKT-DRUCKEN
                         PERFORM C-DRUCKEN
                END-EVALUATE
           END-IF.

           PERFORM Y-NACHLAUF.
       ST-99.
           EXIT PROGRAM.


       A-INIT SECTION.
      ******************************************************************
      *
      ******************************************************************
       A-10.
           MOVE SPACE                          TO SPH-LWT
                                                  SPH-TT
           DISPLAY "LWT"                     UPON ENVIRONMENT-NAME.
           ACCEPT  SPH-LWT                   FROM ENVIRONMENT-VALUE.
           DISPLAY "TT"                      UPON ENVIRONMENT-NAME.
           ACCEPT  SPH-TT                    FROM ENVIRONMENT-VALUE.


           MOVE ZERO                           TO YPCL2PR-RC
                                                  YPCL2PR-MNR
           MOVE SPACE                          TO YPCL2PR-MPAR

           MOVE SPACE                          TO SPS-STATUS
                                                  SPS-OPEN-IN
                                                  SPS-LESEN
                                                  SPH-DEF-FACENAME
           MOVE LOW-VALUE                      TO SPH-BRUSH-TAB
                                                  SPH-PUSH-TAB
           MOVE 1                              TO SPH-SEITE
                                                  WKB-FAKTOR-XY
           MOVE ZERO                           TO SPH-PRINTJOB
                                                  SPH-FONT
                                                  SPH-DEF-WEIGHT
                                                  SPH-DEF-PITCHANDFAMILY
                                                  SPH-PITCHANDFAMILY
                                                  SPH-MSIMG-TRABLT-N
                                                  SPH-HMODULE-MSIMG
                                                  SPH-CODEPAGE
                                                  SPH-CODEPAGE-LAST
                                                  SPH-PAGESIZE
                                                  SPH-HDC
                                                  SPH-HDC0
                                                  SPH-HDC-PRN
                                                  SPH-HDC-COMPI
                                                  SPH-HDC-COMPW1
                                                  SPH-HDC-COMPW2
                                                  SPH-HDC-COMPW3
                                                  SPH-HDC-COMPW4
                                                  SPH-HDC-COMP1
                                                  SPH-HDC-COMP2
                                                  SPH-HDC-COMP3
                                                  SPH-HDC-COMP4
                                                  SPH-HDC-COMPS
                                                  SPH-BMP-COMPI
                                                  SPH-BMP-COMPW1
                                                  SPH-BMP-COMPW2
                                                  SPH-BMP-COMPW3
                                                  SPH-BMP-COMPW4
                                                  SPH-BMP-COMP1
                                                  SPH-BMP-COMP2
                                                  SPH-BMP-COMP3
                                                  SPH-BMP-COMP4
                                                  SPH-BMP-COMPS


           IF
                SPH-TT                   NOT = SPACE
                STRING SPH-LWT
                       "\"
                       SPH-TT
                       "\LOG\PCL2PR.PRT"
                                                  DELIMITED BY "     "
                                             INTO PROTOEQ
           ELSE
                MOVE  "PCL2PR.PRT"             TO PROTOEQ
           END-IF
           MOVE SPACE                          TO PROTO-SATZ
           MOVE ALL "----+"                    TO PROTO-SATZ (1:70)
           PERFORM Z37-PROTO
           ACCEPT PROTO-SATZ (1:8)           FROM DATE
           ACCEPT PROTO-SATZ (10:8)          FROM TIME
           MOVE YPCL2PR-CODEPAGE               TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (19:)
           MOVE YPCL2PR-RESOLUTION             TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (25:)
           MOVE YPCL2PR-PRINTER                TO PROTO-SATZ (32:)
           PERFORM Z37-PROTO
           MOVE YPCL2PR-DATEI                  TO PROTO-SATZ
           PERFORM Z37-PROTO

           PERFORM A4-PRUEF-SCHNITTSTELLE

           EVALUATE TRUE
               WHEN YPCL2PR-FKT-DRUCKEN
                    PERFORM A5-OPEN-INPUT
                    IF
                         SPS-STATUS             = SPACE
                         PERFORM A1-OPEN-DRUCKER
                    END-IF
                    IF
                         SPS-STATUS             = SPACE
                         PERFORM Z5-SETZEN-DEFAULTWERTE
                    END-IF
                    IF
                         SPS-STATUS             = SPACE
                         PERFORM A2-CREATE-BMP
                    END-IF
                    IF
                         SPS-STATUS             = SPACE
                         PERFORM A3-CREATE-HWND
                    END-IF
           END-EVALUATE.
       A-99.
           EXIT.


       A1-OPEN-DRUCKER SECTION.
      ******************************************************************
      * RAN AN DEN DRUCKER
      ******************************************************************
       A1-10.
           MOVE 8                              TO ICTRL-SIZE
           MOVE 4                              TO ICTRL-ICC
           CALL WINAPI "InitCommonControlsEx"
                                  USING
                                  BY REFERENCE INITCTRL
                                  RETURNING SPH-RC
           IF
                SPH-RC                          = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           MOVE YPCL2PR-PRINTER                TO SPH-PRINTER

           MOVE LOW-VALUE                      TO SPH-DEVMODE
                                                  SPH-DEVNAMES
                                                  PRINTDLG32
                                                  PRINTDLG64
                                                  DEVMODE2
                                                  DEVMODE3
           MOVE LENGTH OF PRINTDLG32           TO PD32-STRUCTSIZE
           MOVE LENGTH OF PRINTDLG64           TO PD64-STRUCTSIZE
           MOVE ZERO                           TO SPH-HWND-PRINTER

      *IF
      *             64-BIT = 1
      *    CALL WINAPI "GetModuleHandleA"
      *                           USING
      *                           BY VALUE 0 SIZE 4
      *                           RETURNING PD64-HINSTANCE
      *ELSE
      *    CALL WINAPI "GetModuleHandleA"
      *                           USING
      *                           BY VALUE 0 SIZE 4
      *                           RETURNING PD32-HINSTANCE
      *END

      *-----------------------------------------------------------------
      * HOLEN DER AKTUELLEN EINSTELLUNG
      * DER BEREICH IST BEI X32/X64 UNTERSCHIEDLICH. POINTER MUESSEN
      * AUF X(08) AUSGERICHTET SEIN
      *-----------------------------------------------------------------
      *PD_RETURNDEFAULT
           MOVE H"00000400"                    TO PD32-FLAGS
           MOVE H"00000400"                    TO PD64-FLAGS
      $IF
                    64-BIT = 1
           CALL WINAPI "PrintDlgA"
                                  USING
                                  BY REFERENCE PRINTDLG64
                                  RETURNING SPH-RC
           MOVE PD64-DEVMODE-A                 TO PD-DEVMODE-X
           MOVE PD64-DEVNAMES-A                TO PD-DEVNAMES-X
      $ELSE
           CALL WINAPI "PrintDlgA"
                                  USING
                                  BY REFERENCE PRINTDLG32
                                  RETURNING SPH-RC
           MOVE PD32-DEVMODE-A                 TO PD-DEVMODE-X
           MOVE PD32-DEVNAMES-A                TO PD-DEVNAMES-X
           MOVE PD32-DEVMODE                   TO PD64-DEVMODE
           MOVE PD32-DEVNAMES                  TO PD64-DEVNAMES
      $END



           IF
                SPH-RC                      NOT = ZERO
           AND  PD-DEVMODE-N                NOT = ZERO
           AND  PD-DEVNAMES-N               NOT = ZERO
                CALL WINAPI "GlobalLock"
                                  USING
                                  BY VALUE PD64-DEVMODE
                                  RETURNING SPH-POINTER-N
                IF
                     SPH-POINTER-N              = ZERO
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "GlobalLock1"        TO SPH-MPAR1
                     PERFORM Z7-ERROR
                ELSE
                     SET  ADDRESS OF DEVMODE   TO SPH-POINTER
                     MOVE DEVMODE              TO SPH-DEVMODE
                     CALL WINAPI "GlobalUnlock"
                                  USING
                                  BY VALUE SPH-POINTER-N
                                  RETURNING SPH-RC
                     CALL WINAPI "GlobalFree"
                                  USING
                                  BY VALUE SPH-POINTER-N
                                  RETURNING SPH-RC
                END-IF

                CALL WINAPI "GlobalLock"
                                  USING
                                  BY VALUE PD64-DEVNAMES
                                  RETURNING SPH-POINTER-N
                IF
                     SPH-POINTER-N              = ZERO
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "GlobalLock2"        TO SPH-MPAR1
                     PERFORM Z7-ERROR
                ELSE
                     SET  ADDRESS OF DEVNAMES  TO SPH-POINTER
                     MOVE DEVNAMES (1:8)       TO SPH-DEVNAMES
                     MOVE WDEVICEOFFSET        TO I1
                     ADD  1                    TO I1
                     MOVE WOUTPUTOFFSET        TO I2
                     SUBTRACT WDEVICEOFFSET  FROM I2
                     IF
                          I1                    > ZERO
                     AND  I2                    > ZERO
                     AND (I1 + I2)              < 255
                          MOVE DEVNAMES (I1:I2)
                                               TO SPH-PRINTER (1:I2)
                     ELSE
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "GlobalLock3"   TO SPH-MPAR1
                          PERFORM Z7-ERROR
                     END-IF
                     CALL WINAPI "GlobalUnlock"
                                  USING
                                  BY VALUE SPH-POINTER-N
                                  RETURNING SPH-RC
                     CALL WINAPI "GlobalFree"
                                  USING
                                  BY VALUE SPH-POINTER-N
                                  RETURNING SPH-RC
                END-IF
           ELSE
                IF
                     SPH-RC                     = ZERO
                     CALL WINAPI "CommDlgExtendedError"
                                  RETURNING SPH-RC
                     MOVE "printdlg1a"         TO SPH-MPAR1
                ELSE
                     MOVE "printdlg1b"         TO SPH-MPAR1
                END-IF
                MOVE WKM-2176                  TO SPH-MNR
                MOVE SPH-RC                    TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR1 (12:)
                MOVE PD-DEVMODE-N              TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR2
                MOVE PD-DEVNAMES-N             TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR2 (12:)
                PERFORM Z7-ERROR
           END-IF


           MOVE LOW-VALUE                      TO PRINTDLG32
           MOVE LOW-VALUE                      TO PRINTDLG64
           MOVE LENGTH OF PRINTDLG32           TO PD32-STRUCTSIZE
           MOVE LENGTH OF PRINTDLG64           TO PD64-STRUCTSIZE
      *PD_RETURNDEFAULT
           MOVE H"0400"                        TO PD64-FLAGS
           MOVE H"0400"                        TO PD32-FLAGS
           MOVE H"0400"                        TO PD64-FLAGS
           MOVE H"0400"                        TO PD32-FLAGS
      *PD_RETURNDC
           ADD  H"0100"                        TO PD64-FLAGS
           ADD  H"0100"                        TO PD32-FLAGS
      *PD_DISABLEPRINTTOFILE
           ADD  H"080000"                      TO PD64-FLAGS
           ADD  H"080000"                      TO PD32-FLAGS

           MOVE 1                              TO PD64-COPIES
           MOVE 1                              TO PD32-COPIES
           MOVE H"FFFF"                        TO PD64-FROMPAGE
           MOVE H"FFFF"                        TO PD32-FROMPAGE
           MOVE H"FFFF"                        TO PD64-TOPAGE
           MOVE H"FFFF"                        TO PD32-TOPAGE
           MOVE H"FFFF"                        TO PD64-MAXPAGE
           MOVE H"FFFF"                        TO PD32-MAXPAGE
           MOVE 1                              TO PD64-MINPAGE
           MOVE 1                              TO PD32-MINPAGE
      $IF
                    64-BIT = 1
           CALL WINAPI "PrintDlgA"
                                  USING
                                  BY REFERENCE PRINTDLG64
                                  RETURNING SPH-RC
           MOVE PD64-DEVMODE-A                 TO PD-DEVMODE-X
           MOVE PD64-DEVNAMES-A                TO PD-DEVNAMES-X
      $ELSE
           CALL WINAPI "PrintDlgA"
                                  USING
                                  BY REFERENCE PRINTDLG32
                                  RETURNING SPH-RC
           MOVE PD32-DEVMODE-A                 TO PD-DEVMODE-X
           MOVE PD32-DEVNAMES-A                TO PD-DEVNAMES-X
           MOVE PD32-HDC                       TO PD64-HDC
      $END
           IF
                SPH-RC                          = 0
                CALL WINAPI "CommDlgExtendedError"
                                  RETURNING SPH-RC
                MOVE WKM-2176                  TO SPH-MNR
                MOVE "PrintDlg2"               TO SPH-MPAR1
                MOVE SPH-RC                    TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR2
                PERFORM Z7-ERROR
           ELSE
                IF
                     PD64-HDC                   = LOW-VALUE
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "PrintDlg2"          TO SPH-MPAR1
                     PERFORM Z7-ERROR
                END-IF
           END-IF
           MOVE PD64-HDC                       TO SPH-HDC
                                                  SPH-HDC-PRN

           MOVE SPACE                          TO SPH-X32
           MOVE PD64-FLAGS                     TO I2
           PERFORM VARYING I1 FROM 1 BY 1
                     UNTIL I1 > 32
              DIVIDE I2                        BY 2
                                           GIVING I2
                                        REMAINDER SPH-B32 (I1)
           END-PERFORM

           IF
                SPS-STATUS                      = SPACE
                MOVE LOW-VALUE                 TO DOCINFO
                SET  DI-LPSZ-DOCNAME           TO ADDRESS OF DI-DOCNAME
                CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE RC-STRETCHBLT Size 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                 NOT = 0
                     MOVE WKM-2176        TO SPH-MNR
                     MOVE "GetDeviceCaps" TO SPH-MPAR1
                     MOVE "StretchBlt"    TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF
           END-IF

           IF
                SPS-STATUS                      = SPACE
                PERFORM Z8-GETDEVICECAPS
                IF
                     SPH-B32 (6)                = 1
                     SET  DI-LPSZ-OUTPUT       TO ADDRESS OF DI-OUTPUT
                     MOVE DEVNAMES ((WOUTPUTOFFSET + 1):)
                                               TO DI-OUTPUT
                END-IF
           END-IF.


           MOVE SPACE                          TO SPH-PRINTER2
           MOVE YPCL2PR-PRINTER                TO SPH-PRINTER
           STRING SPH-PRINTER
                  X"00"                           DELIMITED BY "    "
                                             INTO SPH-PRINTER2

           IF
                SPS-STATUS                      = SPACE
                CALL WINAPI "OpenPrinterA"
                                  USING
                                  BY REFERENCE SPH-PRINTER2
                                  BY REFERENCE SPH-HWND-PRINTER
                                  BY VALUE 0 SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "OpenPrinter"        TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF
           END-IF.

      *-----------------------------------------------------------------
      * 300 DPI SETZEN
      *-----------------------------------------------------------------
           IF
                SPS-STATUS                      = SPACE
                MOVE 156                       TO DM2SIZE
                                                  DM3SIZE
                CALL WINAPI "DocumentPropertiesA"
                                  USING
                                  BY VALUE 0               SIZE 4
                                  BY VALUE SPH-HWND-PRINTER
                                  BY REFERENCE SPH-PRINTER2
                                  BY REFERENCE DEVMODE2
                                  BY REFERENCE DEVMODE3
                                  BY VALUE 0               SIZE 4
                                  RETURNING SPH-RC
                MOVE "dev2-1 "                 TO PROTO-SATZ
                PERFORM Z40-PROP
                IF
                     SPH-RC                    <= 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-WARN-0007        TO SPH-MNR
                     MOVE "devmode2-1"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR1 (12:)
                     PERFORM Z4-WARNING
                ELSE
      *-----------------------------------------------------------------
      * 32000 IST DIE MAX. BUFFER-SIZE. UND MEHR DARF ES NICHT WERDEN.
      *-----------------------------------------------------------------
                     IF
                          SPH-RC               >= 32000
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "Docprop32000"  TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF

                CALL WINAPI "DocumentPropertiesA"
                                  USING
                                  BY VALUE 0               SIZE 4
                                  BY VALUE SPH-HWND-PRINTER
                                  BY REFERENCE SPH-PRINTER2
                                  BY REFERENCE DEVMODE2
                                  BY REFERENCE DEVMODE3
                                  BY VALUE DM-OUT-BUFFER   SIZE 4
                                  RETURNING SPH-RC
                MOVE "dev2-2 "                 TO PROTO-SATZ
                PERFORM Z40-PROP
                IF
                     SPH-RC                    <= 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-WARN-0007        TO SPH-MNR
                     MOVE "devmode2-2"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR1 (12:)
                     PERFORM Z4-WARNING
                END-IF

                MOVE DM-YRESOLUTION            TO DM2FIELDS
                MOVE 300                       TO DM2YRESOLUTION

                ADD  DM-PRINTQUALITY           TO DM2FIELDS
                MOVE 300                       TO DM2PRINTQUALITY

                ADD  DM-PAPERLENGTH            TO DM2FIELDS
                MOVE 2980                      TO DM2PAPERLENGTH
                IF
                     SPH-PAGESIZE               = 3
                     MOVE 3500                 TO DM2PAPERLENGTH
                END-IF
                ADD  DM-PAPERWIDTH             TO DM2FIELDS
                MOVE 2100                      TO DM2PAPERWIDTH
      *-----------------------------------------------------------------
      * 9   = A4
      * 53  = A4-EXTRA
      * 256 = PAPER-USER
      *-----------------------------------------------------------------
                MOVE 0                         TO DM2PAPERSIZE
                ADD  DM-PAPERSIZE              TO DM2FIELDS

                MOVE X"00"                     TO DM2FORMNAME
                ADD  DM-FORMNAME               TO DM2FIELDS

                CALL WINAPI "DocumentPropertiesA"
                                  USING
                                  BY VALUE 0                   SIZE 4
                                  BY VALUE SPH-HWND-PRINTER
                                  BY REFERENCE SPH-PRINTER2
                                  BY REFERENCE DEVMODE2
                                  BY REFERENCE DEVMODE2
                                  BY VALUE DM-IN-OUT-BUFFER    SIZE 4
                                  RETURNING SPH-RC
                MOVE "dev2-3 "                 TO PROTO-SATZ
                PERFORM Z40-PROP
                IF
                     SPH-RC                    <= 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-WARN-0007        TO SPH-MNR
                     MOVE "devmode2-3"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR1 (12:)
                     PERFORM Z4-WARNING
                ELSE
                     EVALUATE TRUE
                        WHEN YPCL2PR-RESOLUTION > ZERO
                             MOVE YPCL2PR-RESOLUTION
                                               TO WKB-DPI-IST
                        WHEN DM2YRESOLUTION     > ZERO
                             MOVE DM2YRESOLUTION
                                               TO WKB-DPI-IST
                        WHEN OTHER
                             MOVE 600          TO WKB-DPI-IST
                     END-EVALUATE
                     PERFORM Z5-SETZEN-DEFAULTWERTE
                END-IF
           END-IF.

      *-----------------------------------------------------------------
      * BRUSH ERZEUGEN
      *-----------------------------------------------------------------
           IF
                SPS-STATUS                      = SPACE
                MOVE ZERO                      TO SPH-COL
                MOVE SPH-COL                   TO SPH-COL-BLACK
                MOVE ZERO                      TO SPH-COL
                MOVE 255                       TO SPH-COL-R
                MOVE 255                       TO SPH-COL-G
                MOVE 255                       TO SPH-COL-B
                MOVE SPH-COL                   TO SPH-COL-WHITE
                MOVE ZERO                      TO SPH-COL
                CALL WINAPI 'CreateSolidBrush'
                                  USING
                                  BY VALUE SPH-COL
                                  RETURNING SPH-BRUSH-BLACK
                MOVE ZERO                      TO SPH-COL
                MOVE 255                       TO SPH-COL-R
                MOVE 255                       TO SPH-COL-G
                MOVE 255                       TO SPH-COL-B
                CALL WINAPI 'CreateSolidBrush'
                                  USING
                                  BY VALUE SPH-COL
                                  RETURNING SPH-BRUSH-WHITE
           END-IF.


      *-----------------------------------------------------------------
      * TRANSPARENTBLT
      *-----------------------------------------------------------------
           IF
                SPS-STATUS                      = SPACE
                IF
                     SPH-HMODULE-MSIMG          = 0
                     MOVE "MSIMG32.DLL"        TO SPH-LIB
                     MOVE X"00"                TO SPH-LIB (12:1)
                     CALL WINAPI "LoadLibraryA"
                                  USING
                                  BY REFERENCE SPH-LIB
                                  RETURNING SPH-HMODULE-MSIMG
                     IF
                          SPH-HMODULE-MSIMG     = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "loadlib"       TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
                IF
                     SPH-MSIMG-TRABLT-N         = 0
                AND  SPH-HMODULE-MSIMG      NOT = 0
                     MOVE "TransparentBlt"     TO SPH-PROC
                     MOVE X"00"                TO SPH-PROC (15:1)
                     CALL WINAPI "GetProcAddress"
                                  USING
                                  BY VALUE     SPH-HMODULE-MSIMG
                                  BY REFERENCE SPH-PROC
                                  RETURNING SPH-MSIMG-TRABLT-N
                     IF
                          SPH-MSIMG-TRABLT-N    = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "getprocadr"    TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
           END-IF.
       A1-99.
           EXIT.


       A2-CREATE-BMP SECTION.
      ******************************************************************
      * CREATE BMP-FILE
      ******************************************************************
       A2-10.
           PERFORM VARYING I-SH FROM 1 BY 1
                     UNTIL I-SH > 14
              MOVE WKB-SHADE (I-SH) (1:6)      TO WKB-SHADE (15)
              MOVE I-SH                        TO SPH-N2
              MOVE SPACE                       TO AUSGABEEQ
              IF
                   SPH-TT                   NOT = SPACE
                   STRING SPH-LWT
                     "\"
                     SPH-TT
                     "\TEMP\INTEX_SHADE_"
                     SPH-N2-A
                     ".BMP"                       DELIMITED BY "     "
                                             INTO AUSGABEEQ
              ELSE
                   STRING "INTEX_SHADE_"
                     SPH-N2-A
                     ".BMP"                       DELIMITED BY "     "
                                             INTO AUSGABEEQ
              END-IF
              OPEN OUTPUT AUSGABE
              IF
                   FILE-RC (1:1)                = "0"
      *-----------------------------------------------------------------
      * HEADER
      *-----------------------------------------------------------------
                   PERFORM VARYING I1 FROM 1 BY 1
                             UNTIL I1 > 54
                      MOVE WKB-SHADE-HEADER (I1:1)
                                               TO AUSGABE-SATZ
                      WRITE AUSGABE-SATZ
                   END-PERFORM
      *-----------------------------------------------------------------
      * SHADE 15 ALLGEMEIN
      *-----------------------------------------------------------------
                   MOVE 1                      TO I-SY
                   PERFORM VARYING I1 FROM 1 BY 1
                             UNTIL I1 > 24
                      MOVE 1                   TO I-SX
                      PERFORM VARYING I2 FROM 1 BY 1
                                UNTIL I2 > 24
                         IF
                              WKB-SHADE-PIXEL (I-SH I-SY I-SX)
                                            NOT = SPACE
                              MOVE "X"         TO WKB-SHADE-PIXEL
                                                  (15 I1 I2)
                         END-IF
                         ADD  1                TO I-SX
                         IF
                             I-SX               > WKB-SHADE-X (I-SH)
                             MOVE 1            TO I-SX
                         END-IF
                      END-PERFORM
                      ADD  1                   TO I-SY
                      IF
                          I-SY                  > WKB-SHADE-Y (I-SH)
                          MOVE 1               TO I-SY
                      END-IF
                   END-PERFORM
                   MOVE WKB-SHADE (15)         TO WKB-SHADE (I-SH)
      *-----------------------------------------------------------------
      * INHALT
      *-----------------------------------------------------------------
                   PERFORM VARYING I-SY FROM 24 BY -1
                             UNTIL I-SY < 1
                      PERFORM VARYING I-SX FROM 1 BY 1
                                UNTIL I-SX > 24
                         IF
                              WKB-SHADE-PIXEL (15 I-SY I-SX)
                                                = SPACE
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                         ELSE
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                         END-IF
                      END-PERFORM
                   END-PERFORM
                   CLOSE AUSGABE
              END-IF
           END-PERFORM.


           PERFORM VARYING I-SH FROM 1 BY 1
                     UNTIL I-SH > 14
              MOVE WKB-SHADE (I-SH) (1:6)      TO WKB-SHADE (15)
              MOVE I-SH                        TO SPH-N2
              MOVE SPACE                       TO AUSGABEEQ
              IF
                   SPH-TT                   NOT = SPACE
                   STRING SPH-LWT
                     "\"
                     SPH-TT
                     "\TEMP\INTEX_SHADEI_"
                     SPH-N2-A
                     ".BMP"                       DELIMITED BY "     "
                                             INTO AUSGABEEQ
              ELSE
                   STRING "INTEX_SHADEI_"
                     SPH-N2-A
                     ".BMP"                       DELIMITED BY "     "
                                             INTO AUSGABEEQ
              END-IF
              OPEN OUTPUT AUSGABE
              IF
                   FILE-RC (1:1)                = "0"
      *-----------------------------------------------------------------
      * HEADER
      *-----------------------------------------------------------------
                   PERFORM VARYING I1 FROM 1 BY 1
                             UNTIL I1 > 54
                      MOVE WKB-SHADE-HEADER (I1:1)
                                               TO AUSGABE-SATZ
                      WRITE AUSGABE-SATZ
                   END-PERFORM
      *-----------------------------------------------------------------
      * SHADE 15 ALLGEMEIN
      *-----------------------------------------------------------------
                   MOVE 1                      TO I-SY
                   PERFORM VARYING I1 FROM 1 BY 1
                             UNTIL I1 > 24
                      MOVE 1                   TO I-SX
                      PERFORM VARYING I2 FROM 1 BY 1
                                UNTIL I2 > 24
                         IF
                              WKB-SHADE-PIXEL (I-SH I-SY I-SX)
                                            NOT = SPACE
                              MOVE "X"         TO WKB-SHADE-PIXEL
                                                  (15 I1 I2)
                         END-IF
                         ADD  1                TO I-SX
                         IF
                             I-SX               > WKB-SHADE-X (I-SH)
                             MOVE 1            TO I-SX
                         END-IF
                      END-PERFORM
                      ADD  1                   TO I-SY
                      IF
                          I-SY                  > WKB-SHADE-Y (I-SH)
                          MOVE 1               TO I-SY
                      END-IF
                   END-PERFORM
                   MOVE WKB-SHADE (15)         TO WKB-SHADE (I-SH)
      *-----------------------------------------------------------------
      * INHALT
      *-----------------------------------------------------------------
                   PERFORM VARYING I-SY FROM 24 BY -1
                             UNTIL I-SY < 1
                      PERFORM VARYING I-SX FROM 1 BY 1
                                UNTIL I-SX > 24
                         IF
                              WKB-SHADE-PIXEL (15 I-SY I-SX)
                                                = SPACE
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"00"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                         ELSE
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                              MOVE X"FF"       TO AUSGABE-SATZ
                              WRITE AUSGABE-SATZ
                         END-IF
                      END-PERFORM
                   END-PERFORM
                   CLOSE AUSGABE
              END-IF
           END-PERFORM.
       A2-99.
           EXIT.


       A3-CREATE-HWND SECTION.
      ******************************************************************
      * CREATE HWND
      ******************************************************************
       A3-10.
           SET  WND64-LPSZMENUNAME             TO NULL
           SET  WND32-LPSZMENUNAME             TO NULL
           SET  WND64-LPSZCLASSNAME            TO ADDRESS
                                               OF SPH-CLASSNAME2
           SET  WND32-LPSZCLASSNAME            TO ADDRESS
                                               OF SPH-CLASSNAME2
           MOVE 0                              TO SPH-COL
           MOVE 255                            TO SPH-COL-R
           MOVE 255                            TO SPH-COL-G
           MOVE 255                            TO SPH-COL-B
           CALL WINAPI 'CreateSolidBrush'
                                  USING
                                  BY VALUE SPH-COL
                                  RETURNING WND32-HBRBACKGROUND
           MOVE WND32-HBRBACKGROUND            TO WND64-HBRBACKGROUND
           MOVE CSCLASS                        TO WND64-STYLE
           MOVE CSCLASS                        TO WND32-STYLE
           SET  WND64-LPFNWNDPROC              TO ENTRY "WNDPROC"
           SET  WND32-LPFNWNDPROC              TO ENTRY "WNDPROC"
           MOVE 0                              TO WND64-CBCLSEXTRA
           MOVE 0                              TO WND32-CBCLSEXTRA
           MOVE 0                              TO WND64-CBWNDEXTRA
           MOVE 0                              TO WND32-CBWNDEXTRA
           MOVE HINST                          TO WND64-HINSTANCE
           MOVE HINST                          TO WND32-HINSTANCE
           SET  WND64-HICON                    TO NULL
           SET  WND32-HICON                    TO NULL

           PERFORM VARYING I1 FROM 1 BY 1
                     UNTIL I1 > 99
                 MOVE "ItPCL2Pr(  )"           TO SPH-CLASSNAME
                 MOVE X"0000"                  TO SPH-CLASSNAME
                                                  (13:)
                 MOVE I1                       TO SPH-NUM2
                 MOVE SPH-NUM2-A               TO SPH-CLASSNAME
                                                  (10:2)
                 CALL WINAPI "FindWindowA"
                                  USING
                                  BY REFERENCE  SPH-CLASSNAME
                                  BY VALUE      0 SIZE 4
                                  RETURNING     HWINDOW
                 MOVE SPH-CLASSNAME            TO SPH-TITLE
                 MOVE X"0000"                  TO SPH-TITLE (13:2)
                 IF
                      HWINDOW                   = 0
                      MOVE 99                  TO I1
                 END-IF
           END-PERFORM.


           MOVE SPACE                          TO SPH-CLASSNAME2
           CALL WINAPI "MultiByteToWideChar"
                                  USING
                                  BY VALUE 850             SIZE 4
                                  BY VALUE MB-PRECOMPOSED  SIZE 4
                                  BY REFERENCE SPH-CLASSNAME
                                  BY VALUE 12              SIZE 4
                                  BY REFERENCE SPH-CLASSNAME2
                                  BY VALUE 255             SIZE 4
                                  RETURNING SPH-RC
           MOVE SPH-RC                         TO I-L
      *-----------------------------------------------------------------
      * DER BEREICH IST BEI X32/X64 UNTERSCHIEDLICH. POINTER MUESSEN
      * AUF X(08) AUSGERICHTET SEIN
      *-----------------------------------------------------------------
      $IF
                    64-BIT = 1
           CALL WINAPI "RegisterClassW"
                                  USING
                                  WNDCLASS64
                                  RETURNING SPH-RC
      $ELSE
           CALL WINAPI "RegisterClassW"
                                  USING
                                  WNDCLASS32
                                  RETURNING SPH-RC
      $END
           IF
                SPH-RC                          = 0
                CALL WINAPI "GetLastError"
                                    RETURNING SPH-RC
           END-IF

           CALL WINAPI "CreateWindowExW"
                                  USING
                                  BY VALUE 0       SIZE 4
                                  BY REFERENCE SPH-CLASSNAME2
                                  BY REFERENCE SPH-TITLE
                                  BY VALUE MAINSTYLE
                                  BY VALUE 0             SIZE 4
                                  BY VALUE 0             SIZE 4
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  BY VALUE 0       SIZE 4
                                  BY VALUE 0       SIZE 4
                                  BY VALUE HINST
                                  BY VALUE 0       SIZE 4
                                  RETURNING HWINDOW
           IF
                HWINDOW                         = 0
                CALL WINAPI "GetLastError"
                                    RETURNING SPH-RC
           ELSE
                CALL WINAPI "GetDC"
                                  USING
                                  BY VALUE HWINDOW
                                  RETURNING SPH-HDCW
                CALL WINAPI 'SetBkMode'
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE TRANSPARENT SIZE 4
                CALL WINAPI 'SetTextColor'
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE SPH-COL-BLACK
                CALL WINAPI 'SetBkColor'
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE SPH-COL-WHITE
                CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE SPH-FONT
                PERFORM Z22-RELEASEDC
           END-IF.
       A3-99.
           EXIT.


       A4-PRUEF-SCHNITTSTELLE SECTION.
      ******************************************************************
      * DIVERSE PRUEFUNGEN
      ******************************************************************
       A4-10.
      *-----------------------------------------------------------------
      * DATEINAMEN EXTRAHIEREN
      *-----------------------------------------------------------------
           MOVE YPCL2PR-DATEI                  TO EINGABEEQ
           PERFORM VARYING I1 FROM 128 BY -1
                     UNTIL I1 < 1
              IF
                   EINGABEEQ (I1:1)             = "\"
              OR   EINGABEEQ (I1:1)             = "/"
                   ADD  1                      TO I1
                   MOVE EINGABEEQ (I1:)        TO SPH-DATEI
                   MOVE 1                      TO I1
              END-IF
           END-PERFORM

           IF
                EINGABEEQ                       = SPACE
                MOVE WKM-0110                  TO SPH-MNR
                MOVE "PRINTFILE"               TO SPH-MPAR2
                PERFORM Z7-ERROR
                MOVE WKA-ENDE                  TO SPS-STATUS
           END-IF.

           EVALUATE TRUE
               WHEN NOT  YPCL2PR-FKT-GUELTIG
                    MOVE "FKT"                 TO SPH-MPAR1
                    MOVE WKM-0195              TO SPH-MNR
                    MOVE "YPCL2PR"             TO SPH-MPAR2
                    PERFORM Z7-ERROR
           END-EVALUATE.
       A4-99.
           EXIT.


       A5-OPEN-INPUT SECTION.
      ******************************************************************
      * RAN AN DIE DATEI
      ******************************************************************
       A5-10.
           OPEN INPUT EINGABE
           IF
                FILE-RC                     NOT = ZEROES
                MOVE WKM-8204                  TO SPH-MNR
                MOVE SPH-DATEI                 TO SPH-MPAR2
                MOVE "OPEN"                    TO SPH-MPAR1
                MOVE FILE-RC                   TO SPH-MPAR1 (5:)
                PERFORM Z7-ERROR
                MOVE WKA-NEIN                  TO SPS-STATUS
           ELSE
                MOVE WKA-JA                    TO SPS-OPEN-IN
           END-IF.
       A5-99.
           EXIT.


       C-DRUCKEN SECTION.
      ******************************************************************
      * EINLESEN BYTE FUER BYTE, GRAFIKBEREICHE MARKIEREN UND DANN
      * ZEILE FUER ZEILE SCANNEN
      ******************************************************************
       C-10.
           MOVE SPACE                          TO SPH-SATZ
                                                  SPS-LESEN
           MOVE ZERO                           TO I-P
                                                  I-WB
           PERFORM UNTIL SPS-LESEN          NOT = SPACE
                      OR SPS-STATUS         NOT = SPACE
              READ EINGABE
                   AT END
                      MOVE WKA-NEIN            TO SPS-LESEN
              END-READ
              IF
                   SPS-LESEN                    = SPACE
                   IF
                        I-P                     < WKB-CHAR-MAX
                        ADD  1                 TO I-P
                        MOVE EINGABE-SATZ      TO SPH-SATZ (I-P:1)
                   ELSE
                        DISPLAY "error processing file: missing CRLF"
                   END-IF
              END-IF
      *-----------------------------------------------------------------
      * RASTERGRAFIK ERKENNEN UND HIER NICHT AUF CR,LF REAGIEREN
      *-----------------------------------------------------------------
              IF
                   SPH-SATZ (I-P:1)             = "W"
                   IF
                        I-P                     > 7
                   AND  I-WB                    = ZERO
                        MOVE I-P               TO I1
                                                  I2
                        SUBTRACT 7           FROM I1
                        SUBTRACT 4           FROM I2
                        IF
                             SPH-SATZ (I1:3)    = WKB-ESC-STERN-KL-B
                        AND  SPH-SATZ (I2:4)      NUMERIC
                             MOVE I1           TO I-WV
                             MOVE SPH-SATZ (I2:4)
                                               TO SPH-N4-A
                             MOVE I-P          TO I-WB
                             ADD  SPH-N4       TO I-WB
                        END-IF
                   END-IF
                   IF
                        I-P                     > 6
                   AND  I-WB                    = ZERO
                        MOVE I-P               TO I1
                                                  I2
                        SUBTRACT 6           FROM I1
                        SUBTRACT 3           FROM I2
                        IF
                             SPH-SATZ (I1:3)    = WKB-ESC-STERN-KL-B
                        AND  SPH-SATZ (I2:3)      NUMERIC
                             MOVE I1           TO I-WV
                             MOVE ZERO         TO SPH-N4
                             MOVE SPH-SATZ (I2:3)
                                               TO SPH-N4-A (2:)
                             MOVE I-P          TO I-WB
                             ADD  SPH-N4       TO I-WB
                        END-IF
                   END-IF
                   IF
                        I-P                     > 5
                   AND  I-WB                    = ZERO
                        MOVE I-P               TO I1
                                                  I2
                        SUBTRACT 5           FROM I1
                        SUBTRACT 2           FROM I2
                        IF
                             SPH-SATZ (I1:3)    = WKB-ESC-STERN-KL-B
                        AND  SPH-SATZ (I2:2)      NUMERIC
                             MOVE I1           TO I-WV
                             MOVE ZERO         TO SPH-N4
                             MOVE SPH-SATZ (I2:2)
                                               TO SPH-N4-A (3:)
                             MOVE I-P          TO I-WB
                             ADD  SPH-N4       TO I-WB
                        END-IF
                   END-IF
                   IF
                        I-P                     > 4
                   AND  I-WB                    = ZERO
                        MOVE I-P               TO I1
                                                  I2
                        SUBTRACT 4           FROM I1
                        SUBTRACT 1           FROM I2
                        IF
                             SPH-SATZ (I1:3)    = WKB-ESC-STERN-KL-B
                        AND  SPH-SATZ (I2:1)      NUMERIC
                             MOVE I1           TO I-WV
                             MOVE ZERO         TO SPH-N4
                             MOVE SPH-SATZ (I2:1)
                                               TO SPH-N4-A (4:)
                             MOVE I-P          TO I-WB
                             ADD  SPH-N4       TO I-WB
                        END-IF
                   END-IF
              END-IF

              IF
                   I-P                          > ZERO
                   EVALUATE TRUE
                       WHEN SPH-SATZ (I-P:1)    = WKB-CR
                        AND I-P                 > I-WB
                            SUBTRACT 1       FROM I-P
                            IF
                                 I-P            > ZERO
                                 PERFORM C1-EINE-ZEILE
                            END-IF
                            PERFORM C2-CR

                       WHEN SPH-SATZ (I-P:1)    = WKB-LF
                        AND I-P                 > I-WB
                            SUBTRACT 1      FROM I-P
                            IF
                                 I-P           > ZERO
                                 PERFORM C1-EINE-ZEILE
                            END-IF
                            PERFORM C3-LF

                       WHEN SPH-SATZ (I-P:1)    = WKB-FF
                        AND I-P                 > I-WB
                            SUBTRACT 1      FROM I-P
                            IF
                                 I-P           > ZERO
                                 PERFORM C1-EINE-ZEILE
                            END-IF
                            PERFORM Z6-SEITE-RAUS

                       WHEN I-P                 = I-WB
                            PERFORM C1-EINE-ZEILE
                            MOVE ZERO          TO I-WB
                                                  I-WV

                   END-EVALUATE
              END-IF
              IF
                   I-P                          > ZERO
              AND  SPS-LESEN                    = WKA-NEIN
                   PERFORM C1-EINE-ZEILE
              END-IF
           END-PERFORM.

           IF
                SPS-LESEN                       = WKA-NEIN
           AND  SPS-STATUS                      = SPACE
           AND  SPS-DATA                        = WKA-JA
                PERFORM Z6-SEITE-RAUS
           END-IF.
       C-99.
           EXIT.


       C1-EINE-ZEILE SECTION.
      ******************************************************************
      * AUFDROESELN DER ZEILE IN CHAR-STRINGS UND ESC-SEQUENZEN
      * I-EV = ESC-VON
      * I-EB = ESC-BIS
      * I-CV = CHAR-VON
      * I-CB = CHAR-BIS
      ******************************************************************
       C1-10.
           MOVE ZERO                           TO I-EV
                                                  I-EB
                                                  I-CV
                                                  I-CB

           PERFORM VARYING I-S FROM 1 BY 1
                     UNTIL I-S                  > I-P
                        OR SPS-STATUS       NOT = SPACE
              EVALUATE TRUE
      *-----------------------------------------------------------------
      * IM STRING
      *-----------------------------------------------------------------
                  WHEN I-CV                     > ZERO
                   AND I-CB                     = ZERO
                       IF
                            SPH-SATZ (I-S:1)    = WKB-ESC
                            MOVE I-S           TO I-CB
                                                  I-EV
                            SUBTRACT 1       FROM I-CB
                            IF
                                 I-CV          <= I-CB
                                 PERFORM C1A-CHAR-STRING
                            END-IF
                            MOVE ZERO          TO I-CV
                                                  I-CB
                            PERFORM C1B-ESC-START
                       ELSE
                            IF
                                 I-S            = I-P
                                 MOVE I-S      TO I-CB
                                 IF
                                      I-CV     <= I-CB
                                      PERFORM C1A-CHAR-STRING
                                 END-IF
                                 MOVE ZERO     TO I-CV
                                                  I-CB
                            END-IF
                       END-IF
      *-----------------------------------------------------------------
      * IM NIX: START IM CHAR- ODER ESC-STRING
      *-----------------------------------------------------------------
                  WHEN I-CV                     = ZERO
                   AND I-CB                     = ZERO
                   AND I-EV                     = ZERO
                       IF
                            SPH-SATZ (I-S:1)    = WKB-ESC
                            MOVE I-S           TO I-EV
                            PERFORM C1B-ESC-START
                       ELSE
                            MOVE I-S           TO I-CV
                            IF
                                 I-S            = I-P
                                 MOVE I-S      TO I-CB
                                 IF
                                      I-CV     <= I-CB
                                      PERFORM C1A-CHAR-STRING
                                 END-IF
                                 MOVE ZERO     TO I-CV
                                                  I-CB
                            END-IF
                       END-IF
           END-PERFORM.

           MOVE SPACE                          TO SPH-SATZ
           MOVE ZERO                           TO I-P.
       C1-99.
           EXIT.


       C1A-CHAR-STRING SECTION.
      ******************************************************************
      * WIR DRUCKEN EINEN STRING AUS
      ******************************************************************
       C1A-10.
           MOVE I-CB                           TO I-L
           SUBTRACT I-CV                     FROM I-L
           ADD  1                              TO I-L
           IF
                SPS-DATA                        = SPACE
           AND  SPH-SATZ (I-CV:I-L)             = SPACE
                CONTINUE
           ELSE
                PERFORM C1A1-STRING
           END-IF.
       C1A-99.
           EXIT.

       C1A1-STRING SECTION.
      ******************************************************************
      * WIR DRUCKEN EINEN STRING AUS
      ******************************************************************
       C1A1-10.
           PERFORM Z15-CHECK-STARTPAGE
           MOVE WKA-JA                         TO SPS-DATA.

           MOVE SPH-CODEPAGE                   TO SPH-CODEPAGE-OLD
           IF
                SPH-CODEPAGE-LAST               > ZERO
           AND  SPH-CODEPAGE                    = ZERO
                PERFORM VARYING I-C FROM I-CV BY 1
                          UNTIL I-C > I-CB
                   IF
                        SPH-SATZ (I-C:1)        > X"80"
                        MOVE SPH-CODEPAGE-LAST TO SPH-CODEPAGE
                        MOVE I-CB              TO I-C
                   END-IF
                END-PERFORM
           END-IF

           EVALUATE TRUE
               WHEN SPH-CODEPAGE                = 936
                    PERFORM C1A1A-CHINESISCH
               WHEN SPH-CODEPAGE                > ZERO
                    MOVE SPACE                 TO SPH-TEXT-UTF
                    MOVE I-CV                  TO I-C
                    MOVE I-CB                  TO I-L
                    SUBTRACT I-CV            FROM I-L
                    ADD  1                     TO I-L
                    CALL WINAPI "MultiByteToWideChar"
                                  USING
                                  BY VALUE SPH-CODEPAGE
                                  BY VALUE MB-PRECOMPOSED  SIZE 4
                                  BY REFERENCE SPH-SATZ (I-C:)
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE 255             SIZE 4
                                  RETURNING SPH-RC
                    MOVE SPH-RC                TO I-L
                    PERFORM Z13-TEXTOUT

               WHEN SPH-PITCHANDFAMILY          = 1
                AND SPH-PITCH                   > ZERO
                AND SPS-PITCH                   = WKA-JA
                    PERFORM VARYING I-C FROM I-CV BY 1
                              UNTIL I-C > I-CB
                        MOVE 1                 TO I-L
                        PERFORM Z13-TEXTOUT
                    END-PERFORM

               WHEN OTHER
                    MOVE I-CV                  TO I-C
                    MOVE I-CB                  TO I-L
                    SUBTRACT I-CV            FROM I-L
                    ADD  1                     TO I-L
                    PERFORM Z13-TEXTOUT

           END-EVALUATE.
           MOVE SPH-CODEPAGE-OLD               TO SPH-CODEPAGE.
       C1A1-99.
           EXIT.


       C1A1A-CHINESISCH SECTION.
      ******************************************************************
      * PRO TEILBEREICH NEU POSITIONIEREN
      ******************************************************************
       C1A1A-10.
           MOVE I-CV                           TO I-C
           MOVE I-CB                           TO I-L
           SUBTRACT I-CV                     FROM I-L
           ADD  1                              TO I-L
           MOVE SPH-SATZ (I-C:I-L)             TO SPH-TEXT
           MOVE ZERO                           TO I-CHV
                                                  I-CHB

           MOVE I-L                            TO I-L2
           PERFORM VARYING I-S2 FROM 1 BY 1
                     UNTIL I-S2                 > I-L2
                        OR SPS-STATUS       NOT = SPACE
              EVALUATE TRUE
      *-----------------------------------------------------------------
      * IM STRING
      *-----------------------------------------------------------------
                  WHEN I-CHV                    > ZERO
                   AND I-CHB                    = ZERO
                       IF
                            SPH-TEXT (I-S2:1)   = SPACE
                            MOVE I-S2          TO I-CHB
                            SUBTRACT 1       FROM I-CHB
                            IF
                                 I-CHV         <= I-CHB
                                 PERFORM C1A1A1-TEILSTRING
                            END-IF
                            MOVE ZERO          TO I-CHV
                                                  I-CHB
                            ADD  SPH-HMI       TO SPH-X
                       ELSE
                            IF
                                 I-S2           = I-L2
                                 MOVE I-S2     TO I-CHB
                                 IF
                                      I-CHV    <= I-CHB
                                      PERFORM C1A1A1-TEILSTRING
                                 END-IF
                                 MOVE ZERO     TO I-CHV
                                                  I-CHB
                            END-IF
                       END-IF
      *-----------------------------------------------------------------
      * IM NIX: START IM CHAR-STRING
      *-----------------------------------------------------------------
                  WHEN I-CHV                    = ZERO
                   AND I-CHB                    = ZERO
                       IF
                            SPH-TEXT (I-S2:1)   = SPACE
                            ADD  SPH-HMI       TO SPH-X
                       ELSE
                            MOVE I-S2          TO I-CHV
                            IF
                                 I-S2           = I-L2
                                 MOVE I-S2     TO I-CHB
                                 IF
                                      I-CHV    <= I-CHB
                                      PERFORM C1A1A1-TEILSTRING
                                 END-IF
                                 MOVE ZERO     TO I-CHV
                                                  I-CHB
                            END-IF
                       END-IF
           END-PERFORM.
       C1A1A-99.
           EXIT.


       C1A1A1-TEILSTRING SECTION.
      ******************************************************************
      * PRO TEILBEREICH NEU POSITIONIEREN
      ******************************************************************
       C1A1A1-10.
           SUBTRACT I-CHV                    FROM I-CHB
                                           GIVING I-L
           ADD  1                              TO I-L

           CALL WINAPI "MultiByteToWideChar"
                                  USING
                                  BY VALUE SPH-CODEPAGE
                                  BY VALUE MB-PRECOMPOSED  SIZE 4
                                  BY REFERENCE SPH-TEXT (I-CHV:)
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE 255             SIZE 4
                                  RETURNING SPH-RC
           MOVE SPH-RC                         TO I-L
           PERFORM Z13-TEXTOUT.
       C1A1A1-99.
           EXIT.


       C1B-ESC-START SECTION.
      ******************************************************************
      * START EINES ESC-STRINGS. SUCHEN DAS ENDE
      ******************************************************************
       C1B-10.
           MOVE SPACE                          TO SPS-ESC-TYP
           MOVE SPACE                          TO SPH-PRAEFIX
           MOVE ZERO                           TO SPH-PRAEFIXL
           MOVE SPACE                          TO SPH-END
           MOVE ZERO                           TO I-E

           PERFORM VARYING I3 FROM I-EV BY 1
                     UNTIL I3   > I-P
                        OR I-EB > ZERO

              IF
                   SPH-SATZ (I-EV:3)            = WKB-ESC-STERN-KL-B
                   MOVE I-EV                   TO I-EV1
                                                  I-EV2
                                                  I-EV3
                                                  I-EV4
                                                  I-EV5
                   ADD  3                      TO I-EV1
                   ADD  4                      TO I-EV2
                   ADD  5                      TO I-EV3
                   ADD  6                      TO I-EV4
                   ADD  7                      TO I-EV5
                   IF
                       (SPH-SATZ (I-EV1:1)        NUMERIC
                   AND  SPH-SATZ (I-EV2:1)      = "W")
                   OR  (SPH-SATZ (I-EV1:1)        NUMERIC
                   AND  SPH-SATZ (I-EV2:1)        NUMERIC
                   AND  SPH-SATZ (I-EV3:1)      = "W")
                   OR  (SPH-SATZ (I-EV1:1)        NUMERIC
                   AND  SPH-SATZ (I-EV2:1)        NUMERIC
                   AND  SPH-SATZ (I-EV3:1)        NUMERIC
                   AND  SPH-SATZ (I-EV4:1)      = "W")
                   OR  (SPH-SATZ (I-EV1:1)        NUMERIC
                   AND  SPH-SATZ (I-EV2:1)        NUMERIC
                   AND  SPH-SATZ (I-EV3:1)        NUMERIC
                   AND  SPH-SATZ (I-EV4:1)        NUMERIC
                   AND  SPH-SATZ (I-EV5:1)      = "W")
                        SET  SPS-ESC-RASTER-DATA
                                               TO TRUE
                        MOVE "*b"              TO SPH-PRAEFIX
                        MOVE 2                 TO SPH-PRAEFIXL
                        MOVE "W"               TO SPH-END
                        PERFORM C1B1-RASTER-DATA
                   END-IF
              END-IF

              IF
                   SPH-SATZ (I-EV:2)            = WKB-ESC-9
              AND  I-EB                         = ZERO
                   ADD  1                      TO I3
                   MOVE SPH-SATZ (I3:1)        TO SPH-END
                   MOVE I3                     TO I-EB
              END-IF

              IF
                  (SPH-SATZ (I3:1)             >= "A"
              AND  SPH-SATZ (I3:1)             <= "Z"
              AND  I-EB                         = ZERO)
              OR  (SPH-SATZ (I3:1)              = "@"
              AND  I-EB                         = ZERO)

                   MOVE SPH-SATZ (I3:1)        TO SPH-END
                   MOVE I3                     TO I-EB
              END-IF

              IF
                   I-EB                         = ZERO
              AND  I-E                         >= ZERO
                   IF
                        SPH-SATZ (I3:1)           NUMERIC
                        MOVE -1                TO I-E
                   ELSE
                        IF
                             SPH-SATZ (I3:1)
                                            NOT = WKB-ESC
                        AND  I-E                < 2
                             IF
                                  SPH-PRAEFIX   = "("
                             AND  SPH-SATZ (I3:1) NUMERIC
                                  CONTINUE
                             ELSE
                                  ADD  1       TO I-E
                                                  SPH-PRAEFIXL
                                  MOVE SPH-SATZ (I3:1)
                                               TO SPH-PRAEFIX (I-E:1)
                             END-IF
                        END-IF
                   END-IF
              END-IF

           END-PERFORM.

           IF
                I-EB                            > ZERO
                EVALUATE SPH-PRAEFIX   ALSO SPH-END

      *-----------------------------------------------------------------
      * ESC-&a
      *-----------------------------------------------------------------
                    WHEN "&a"          ALSO "C"
                    WHEN "&a"          ALSO "R"
                    WHEN "&a"          ALSO "P"
                         SET  SPS-ESC-MARGINS  TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-&f S PUSH/POP CURSOR
      *-----------------------------------------------------------------
                    WHEN "&f"          ALSO "S"
                         SET  SPS-ESC-PUSHPOP  TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-&f X/Y MAKROS (GIBT ES NICHT BEI GDI)
      *-----------------------------------------------------------------
                    WHEN "&f"          ALSO "X"
                    WHEN "&f"          ALSO "Y"
                         SET  SPS-ESC-MAKRO    TO TRUE

      *-----------------------------------------------------------------
      * ESC-&k
      *-----------------------------------------------------------------
                    WHEN "&k"          ALSO "H"
                         SET  SPS-ESC-HMI      TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-&l
      *-----------------------------------------------------------------
                    WHEN "&l"          ALSO "A"
                    WHEN "&l"          ALSO "C"
                    WHEN "&l"          ALSO "E"
                    WHEN "&l"          ALSO "F"
                    WHEN "&l"          ALSO "O"
                    WHEN "&l"          ALSO "L"
                         SET  SPS-ESC-LINES    TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-&t P
      *-----------------------------------------------------------------
                    WHEN "&t"          ALSO "P"
                         CONTINUE

      *-----------------------------------------------------------------
      * ESC-*bW
      *-----------------------------------------------------------------
                    WHEN "*b"          ALSO "W"
                         CONTINUE

      *-----------------------------------------------------------------
      * ESC-*c
      *-----------------------------------------------------------------
                    WHEN "*c"          ALSO "A"
                    WHEN "*c"          ALSO "B"
                    WHEN "*c"          ALSO "P"
                         SET  SPS-ESC-RECT     TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-*p
      *-----------------------------------------------------------------
                    WHEN "*p"          ALSO "X"
                    WHEN "*p"          ALSO "Y"
                         SET  SPS-ESC-POSI     TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-*r
      *-----------------------------------------------------------------
                    WHEN "*r"          ALSO "A"
                    WHEN "*r"          ALSO "B"
                    WHEN "*r"          ALSO "C"
                    WHEN "*r"          ALSO "F"
                         SET  SPS-ESC-RASTER   TO TRUE
      *!!!!!!!!!!!!!!
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-*t R
      *-----------------------------------------------------------------
                    WHEN "*t"          ALSO "R"
                         SET  SPS-ESC-RESOL    TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-*v
      *-----------------------------------------------------------------
                    WHEN "*v"          ALSO "T"
                         SET  SPS-ESC-PATTERN  TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-(
      *-----------------------------------------------------------------
                    WHEN "("           ALSO ANY
                         SET  SPS-ESC-FONT     TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

                    WHEN "(s"          ALSO "B"
                    WHEN "(s"          ALSO "P"
                    WHEN "(s"          ALSO "S"
                    WHEN "(s"          ALSO "T"
                    WHEN "(s"          ALSO "V"
                         SET  SPS-ESC-FONT     TO TRUE
                         MOVE SPACE            TO SPS-PITCH
                         MOVE SPACE            TO SPS-HEIGHT
                         MOVE LOW-VALUE        TO SPH-LOGFONT
                         MOVE ZERO             TO SPH-PITCHANDFAMILY
                         MOVE SPH-DEF-FACENAME TO SPH-LFFACENAME
                         MOVE SPH-DEF-WEIGHT   TO SPH-LFWEIGHT
                         MOVE SPH-DEF-PITCHANDFAMILY
                                               TO SPH-PITCHANDFAMILY
                         PERFORM Z2-DROESEL-STANDARD

      *-----------------------------------------------------------------
      * ESC-E = RESET
      *-----------------------------------------------------------------
                    WHEN SPACE         ALSO "E"
                         IF
                              SPS-DATA          = WKA-JA
                              PERFORM Z6-SEITE-RAUS
                         END-IF
                         SET  SPS-ESC-RESET    TO TRUE
                         PERFORM Z5-SETZEN-DEFAULTWERTE

      *-----------------------------------------------------------------
      * ESC-9 = CLEAR MARGINS
      *-----------------------------------------------------------------
                    WHEN SPACE         ALSO "9"
                         SET  SPS-ESC-CLEARM   TO TRUE
                         PERFORM Z2-DROESEL-STANDARD

                    WHEN OTHER
                         MOVE WKM-WARN-0001    TO SPH-MNR
                         MOVE "wrong PCL-string"
                                               TO SPH-MPAR1
                         PERFORM Z4-WARNING
                END-EVALUATE
                MOVE I-EB                      TO I-S
           END-IF.

           MOVE ZERO                           TO I-EV
                                                  I-EB.
       C1B-99.
           EXIT.


       C1B1-RASTER-DATA SECTION.
      ******************************************************************
      * START RASTER-DATA: VOR DEM W STEHT DIE ANZAHL BYTES
      ******************************************************************
       C1B1-10.
           PERFORM Z15-CHECK-STARTPAGE
           MOVE WKA-JA                         TO SPS-DATA.

           MOVE 0                              TO SPH-N4
           EVALUATE TRUE
               WHEN SPH-SATZ (I-EV1:1)            NUMERIC
                AND SPH-SATZ (I-EV2:1)          = "W"
                    MOVE SPH-SATZ (I-EV1:1)    TO SPH-N4-A (4:1)
                    MOVE I-EV2                 TO I-EB
               WHEN SPH-SATZ (I-EV1:1)            NUMERIC
                AND SPH-SATZ (I-EV2:1)            NUMERIC
                AND SPH-SATZ (I-EV3:1)          = "W"
                    MOVE SPH-SATZ (I-EV1:2)    TO SPH-N4-A (3:2)
                    MOVE I-EV3                 TO I-EB
               WHEN SPH-SATZ (I-EV1:1)            NUMERIC
                AND SPH-SATZ (I-EV2:1)            NUMERIC
                AND SPH-SATZ (I-EV3:1)            NUMERIC
                AND SPH-SATZ (I-EV4:1)          = "W"
                    MOVE SPH-SATZ (I-EV1:3)    TO SPH-N4-A (2:3)
                    MOVE I-EV4                 TO I-EB
               WHEN SPH-SATZ (I-EV1:1)            NUMERIC
                AND SPH-SATZ (I-EV2:1)            NUMERIC
                AND SPH-SATZ (I-EV3:1)            NUMERIC
                AND SPH-SATZ (I-EV4:1)            NUMERIC
                AND SPH-SATZ (I-EV5:1)          = "W"
                    MOVE SPH-SATZ (I-EV1:4)    TO SPH-N4-A
                    MOVE I-EV5                 TO I-EB
           END-EVALUATE
           MOVE I-EB                           TO I-T
           ADD  1                              TO I-T
           ADD  SPH-N4                         TO I-EB.
           MOVE I-EB                           TO I-S.

           DIVIDE WKB-DPI-IST                  BY SPH-RESOLUTION
                                           GIVING SPH-RASTER-PIXEL
           MOVE SPH-BRUSH-BLACK                TO SPH-BRUSH
           MOVE SPH-BRUSH-WHITE                TO SPH-BRUSHI
           MOVE SPH-Y                          TO SPH-Y2
           MOVE SPH-RASTER-X                   TO SPH-X2
           PERFORM VARYING I1 FROM 1 BY 1
                     UNTIL I1 > SPH-N4
              MOVE SPH-SATZ (I-T:1)            TO SPH-B1-A
              ADD  1                           TO I-T
              PERFORM VARYING I2 FROM 8 BY -1
                        UNTIL I2 < 1
                 DIVIDE SPH-B1                 BY 2
                                        GIVING SPH-B1
                                     REMAINDER SPH-X8-B (I2)
              END-PERFORM
              PERFORM VARYING I2 FROM 1 BY 1
                        UNTIL I2 > 8
                 IF
                      SPH-X8-B (I2)             = 1
                      MOVE SPH-Y               TO SPH-2TOP
                                                  SPH-2BOTTOM
                      MOVE SPH-RASTER-X        TO SPH-2LEFT
                                                  SPH-2RIGHT
                      ADD  SPH-RASTER-PIXEL    TO SPH-2RIGHT
                                                  SPH-2BOTTOM
                      PERFORM Z9-VERSATZ-SPH-2RECT
                      PERFORM Z10-FILLRECT
                 END-IF
                 ADD  SPH-RASTER-PIXEL         TO SPH-RASTER-X
              END-PERFORM
           END-PERFORM.
           MOVE SPH-Y2                         TO SPH-Y
           MOVE SPH-X2                         TO SPH-RASTER-X
           ADD  SPH-RASTER-PIXEL               TO SPH-Y.
       C1B1-99.
           EXIT.


       C2-CR SECTION.
      ******************************************************************
      * X AUF 0 SETZEN
      ******************************************************************
       C2-10.
           MOVE ZERO                           TO SPH-X.
       C2-99.
           EXIT.


       C3-LF SECTION.
      ******************************************************************
      * Y EINE ZEILE WEITER
      ******************************************************************
       C3-10.
           ADD  SPH-VMI                        TO SPH-Y
                                                  SPH-TEXT-Y.
       C3-99.
           EXIT.

       D-WINDOWPROCEDURE SECTION.
      ******************************************************************
      * FUER DAS KONTROLL-WINDOW
      ******************************************************************
       D-10.

           ENTRY "WNDPROC"
                                  USING
                                  BY VALUE HWND
                                  BY VALUE IMESSAGE
                                  BY VALUE WPARAM
                                  BY VALUE LPARAM.

           MOVE 0                              TO LONGRESULT

           CALL WINAPI "DefWindowProcA"
                                  USING
                                  BY VALUE HWND
                                  BY VALUE IMESSAGE
                                  BY VALUE WPARAM
                                  BY VALUE LPARAM
                                  RETURNING LONGRESULT

           EXIT PROGRAM RETURNING LONGRESULT.
       D-99.
           EXIT.


       Y-NACHLAUF SECTION.
      ******************************************************************
      * CLOSE DATEI
      ******************************************************************
       Y-10.
           IF
                SPH-BMP-COMP3               NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMP3
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMP3
           IF
                SPH-HDC-COMP3                NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMP3
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMP3

           IF
                SPH-BMP-COMP4               NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMP4
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMP4
           IF
                SPH-HDC-COMP4                NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMP4
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMP4

           IF
                SPH-BMP-COMPS               NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPS
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPS
           IF
                SPH-HDC-COMPS                NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPS
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPS

           IF
                SPH-BMP-COMP1               NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMP1
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMP1
           IF
                SPH-HDC-COMP1                NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMP1


           IF
                SPH-HDCW                    NOT = ZERO
                CALL WINAPI "ReleaseDC"
                                  USING
                                  BY VALUE HWINDOW
                                  BY VALUE SPH-HDCW
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-HDCW.

           IF
                HWINDOW                     NOT = ZERO
                CALL WINAPI 'DestroyWindow'
                                  USING
                                  BY VALUE HWINDOW
           END-IF

           IF
                SPS-OPEN-IN                     = WKA-JA
                CLOSE EINGABE
           END-IF.

           IF
                SPH-HWND-PRINTER            NOT = ZERO
                IF
                     SPS-DATA                   = WKA-JA
                     PERFORM Z16-SEITE-KOMPLETT
                     CALL WINAPI "EndPage"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-RC
                     IF
                          SPH-RC               <= 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "EndPage"       TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z4-WARNING
                     END-IF
                END-IF
           END-IF

           IF
                SPH-HDC-COMPI                NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  RETURNING SPH-RC
           END-IF.

           IF
                SPH-HDC                      NOT = 0
                CALL WINAPI "EndDoc"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-RC
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-RC
           END-IF.

           IF
                SPH-HWND-PRINTER            NOT = ZERO
                CALL WINAPI "ClosePrinter"
                                  USING
                                  BY VALUE SPH-HWND-PRINTER
                                  RETURNING SPH-RC
           END-IF.
       Y-99.
           EXIT.


       Z2-DROESEL-STANDARD SECTION.
      ******************************************************************
      * ESC-STRING AUFDROESELN. 2 STELLEN PRAEFIX UND DANN DER REST
      ******************************************************************
       Z2-10.
           MOVE SPACE                          TO SPH-ESC-TAB
           MOVE ZERO                           TO SPH-ESC-ANZ.
           PERFORM VARYING I3 FROM I-EB BY -1
                     UNTIL I3 < (I-EV + SPH-PRAEFIXL + 1)
              IF
                  (SPH-SATZ (I3:1)             >= "A"
              AND  SPH-SATZ (I3:1)             <= "Z")
              OR  (SPH-SATZ (I3:1)             >= "a"
              AND  SPH-SATZ (I3:1)             <= "z")
                   ADD  1                      TO SPH-ESC-ANZ
                   MOVE SPH-SATZ (I3:1)        TO SPH-ESC2 (SPH-ESC-ANZ)
                   MOVE 0                      TO SPH-ESC1N(SPH-ESC-ANZ)
                   MOVE 0                      TO SPH-POTENZ
                   MOVE 1                      TO SPH-DIVISOR
                   MOVE 9                      TO I4
                   SUBTRACT 1                FROM I3
                   PERFORM VARYING I5 FROM I3 BY -1
                             UNTIL I5 < (I-EV + SPH-PRAEFIXL + 1)
                      EVALUATE TRUE
                          WHEN SPH-SATZ (I5:1)  = "+"
                          WHEN SPH-SATZ (I5:1)  = "-"
                               SUBTRACT 1        FROM I4
                               MOVE SPH-SATZ (I5:1)
                                               TO SPH-ESCV (SPH-ESC-ANZ)
                                                  SPH-ESC3 (SPH-ESC-ANZ)
                                                           (I4:1)
                               MOVE "0"        TO SPH-ESC1 (SPH-ESC-ANZ)
                                                           (I4:1)
                               MOVE I5         TO I3
                               SUBTRACT 1    FROM I3
                          WHEN SPH-SATZ (I5:1)  = "."
                               MOVE I5         TO I3
                               SUBTRACT 1    FROM I3
                               COMPUTE SPH-DIVISOR
                                                = 10 ** SPH-POTENZ
                          WHEN SPH-SATZ (I5:1)    NUMERIC
                               ADD  1              TO SPH-POTENZ
                               SUBTRACT 1        FROM I4
                               MOVE SPH-SATZ (I5:1)
                                               TO SPH-ESC1 (SPH-ESC-ANZ)
                                                           (I4:1)
                                                  SPH-ESC3 (SPH-ESC-ANZ)
                                                           (I4:1)
                               MOVE I5         TO I3
                               SUBTRACT 1    FROM I3
                          WHEN OTHER
                               MOVE 1          TO I5
                      END-EVALUATE
                   END-PERFORM

                   MOVE SPH-ESC1N (SPH-ESC-ANZ)
                                               TO SPH-WERT
                   DIVIDE SPH-WERT             BY SPH-DIVISOR
                                           GIVING SPH-ESC1D
                                                  (SPH-ESC-ANZ)
                   IF
                        SPH-ESCV (SPH-ESC-ANZ)  = "-"
                        MULTIPLY SPH-ESC1D (SPH-ESC-ANZ)
                                               BY -1
                                           GIVING SPH-ESC1D
                                                  (SPH-ESC-ANZ)
                   END-IF
                   ADD  1                      TO I3
              END-IF
           END-PERFORM.

           INSPECT SPH-ESC-TAB2        CONVERTING WKB-ALPHABET-KLEIN
                                               TO WKB-ALPHABET-GROSS.

           PERFORM Z3-EVAL-ESC-TAB.
       Z2-99.
           EXIT.


       Z3-EVAL-ESC-TAB SECTION.
      ******************************************************************
      * ESC-TAB INTERPRETIEREN
      * DA DAS HUNDERTE SEIN WERDEN, IST DIE BENENNUNG DER
      * UNTERSECTIONS ALS Z3A1- BIS Z3A999- GEWOLLT
      ******************************************************************
       Z3-10.
           PERFORM VARYING I-ESC FROM 64 BY -1
                     UNTIL I-ESC < 1
              EVALUATE SPH-PRAEFIX ALSO SPH-ESC2 (I-ESC)

                  WHEN ANY         ALSO SPACE
                  WHEN "("         ALSO ANY
                       CONTINUE

                  WHEN SPACE       ALSO "9"
                       MOVE 0                  TO SPH-X

                  WHEN "&a"        ALSO "C"
                       COMPUTE SPH-X            = SPH-ESC1D (I-ESC)
                                                  * SPH-HMI

                  WHEN "&a"        ALSO "R"
                       IF
                            SPH-ESCV (I-ESC)    = "-"
                       OR   SPH-ESCV (I-ESC)    = "+"
                            COMPUTE SPH-Y       = SPH-ESC1D (I-ESC)
                                                  * SPH-VMI
                                                  + SPH-Y
                            COMPUTE SPH-TEXT-Y  = SPH-ESC1D (I-ESC)
                                                  * SPH-VMI
                                                  + SPH-TEXT-Y
                       ELSE
                            COMPUTE SPH-Y       = SPH-ESC1D (I-ESC)
                                                  * SPH-VMI
                            COMPUTE SPH-TEXT-Y  = SPH-ESC1D (I-ESC)
                                                  * SPH-VMI
                                                  + SPH-VMI
                       END-IF

                  WHEN "&a"        ALSO "P"
                       MOVE SPH-ESC1D (I-ESC)  TO SPH-ROTATION

                  WHEN "&f"        ALSO "S"
                       PERFORM Z3A7-PUSHPOP

                  WHEN "&k"        ALSO "H"
                       PERFORM Z3A8-HMI
                       IF
                            SPH-PITCHANDFAMILY  = 1
                            PERFORM Z14-FONT
                       END-IF

                  WHEN "&l"        ALSO "A"
                       PERFORM Z3A1-PAGESIZE

                  WHEN "&l"        ALSO "C"
                       COMPUTE SPH-VMI          = SPH-ESC1D (I-ESC)
                                                / 48
                                                * WKB-DPI-IST

                  WHEN "&l"        ALSO "F"
                       CONTINUE

                  WHEN "&l"        ALSO "O"
                       PERFORM Z3A2-PAGEORIENTATION

                  WHEN "&l"        ALSO "E"
                       COMPUTE SPH-MARGIN-Y     = SPH-ESC1D (I-ESC)
                                                * SPH-VMI

                  WHEN "&l"        ALSO "L"
                       CONTINUE

                  WHEN "*c"        ALSO "A"
                       MULTIPLY SPH-ESC1D (I-ESC)
                                               BY WKB-FAKTOR-XY
                                           GIVING SPH-RECT-X

                  WHEN "*c"        ALSO "B"
                       MULTIPLY SPH-ESC1D (I-ESC)
                                               BY WKB-FAKTOR-XY
                                           GIVING SPH-RECT-Y

                  WHEN "*c"        ALSO "G"
                       MOVE SPH-ESC1D (I-ESC)  TO SPH-RECT-SHADE

                  WHEN "*c"        ALSO "P"
                       PERFORM Z3A6-RECT-PRINT

                  WHEN "*p"        ALSO "X"
                       IF
                            SPH-ESCV (I-ESC)    = SPACE
                            MULTIPLY SPH-ESC1D (I-ESC)
                                               BY WKB-FAKTOR-XY
                                           GIVING SPH-X
                       ELSE
                            COMPUTE SPH-X       = SPH-X
                                                + SPH-ESC1D (I-ESC)
                                                * WKB-FAKTOR-XY
                       END-IF

                  WHEN "*p"        ALSO "Y"
                       IF
                            SPH-ESCV (I-ESC)    = SPACE
                            MULTIPLY SPH-ESC1D (I-ESC)
                                               BY WKB-FAKTOR-XY
                                           GIVING SPH-Y
                       ELSE
                            COMPUTE SPH-Y       = SPH-Y
                                                + SPH-ESC1D (I-ESC)
                                                * WKB-FAKTOR-XY
                       END-IF
                       MOVE SPH-Y              TO SPH-TEXT-Y
                       MOVE WKA-JA             TO SPS-POSI-Y

                  WHEN "*r"        ALSO "A"
                       IF
                            SPH-ESC1D (I-ESC)   = 1
                            MOVE SPH-X         TO SPH-RASTER-X
                       ELSE
                            MOVE 0             TO SPH-RASTER-X
                       END-IF

                  WHEN "*r"        ALSO "B"
                  WHEN "*r"        ALSO "C"
                  WHEN "*r"        ALSO "F"
                       CONTINUE

                  WHEN "*t"        ALSO "R"
                       PERFORM Z3A3-RESOLUTION

                  WHEN "*v"        ALSO "T"
                       IF
                            SPH-ESC1D (I-ESC)  >= ZERO
                       AND  SPH-ESC1D (I-ESC)  <= 4
                            PERFORM Z12-ERM-PATTERN
                       END-IF

                  WHEN "(s"        ALSO "P"
                       EVALUATE SPH-ESC1D (I-ESC)
                           WHEN ZERO
                                MOVE 1         TO SPH-PITCHANDFAMILY
                           WHEN 1
                                MOVE ZERO      TO SPH-PITCHANDFAMILY
                       END-EVALUATE

                  WHEN "(s"        ALSO "B"
                       PERFORM Z3A5-STROKE-WEIGHT

                  WHEN "(s"        ALSO "H"
                       MOVE WKA-JA             TO SPS-PITCH
                       MOVE SPH-ESC1D (I-ESC)  TO SPH-PITCH

                  WHEN "(s"        ALSO "S"
                       CONTINUE

                  WHEN "(s"        ALSO "T"
                       PERFORM Z3A4-TYPEFACE

                  WHEN "(s"        ALSO "V"
                       MOVE WKA-JA             TO SPS-HEIGHT
                       MOVE SPH-ESC1D (I-ESC)  TO SPH-HEIGHT

                  WHEN OTHER
                       MOVE WKM-WARN-0002      TO SPH-MNR
                       MOVE "wrong PCL-eval"   TO SPH-MPAR1
                       PERFORM Z4-WARNING

              END-EVALUATE
           END-PERFORM.

           IF
                SPH-Y                           < SPH-MIN-Y
                MOVE SPH-MIN-Y                 TO SPH-Y
           END-IF
           IF
                SPH-X                           < ZERO
                MOVE ZERO                      TO SPH-X
           END-IF

           IF
                SPH-PRAEFIX                     = "(s"
                PERFORM Z14-FONT
           END-IF.
       Z3-99.
           EXIT.


       Z3A1-PAGESIZE SECTION.
      ******************************************************************
      * 1    EXECUTIVE
      * 2    LETTER
      * 3    LEGAL
      * 26   A4
      ******************************************************************
       Z3A1-10.
           IF
                SPS-DATA                        = WKA-JA
                PERFORM Z6-SEITE-RAUS
           END-IF

           EVALUATE SPH-ESC1D (I-ESC)
               WHEN 1
                    MOVE 3150                  TO SPH-PAGE-Y
                    MOVE 50                    TO SPH-START-Y
                    MOVE 25                    TO SPH-START-X
                    MOVE 2175                  TO SPH-PAGE-X
                    MOVE 50                    TO SPH-MARGIN-X
               WHEN 2
                    MOVE 3300                  TO SPH-PAGE-Y
                    MOVE 50                    TO SPH-START-Y
                    MOVE 25                    TO SPH-START-X
                    MOVE 2550                  TO SPH-PAGE-X
                    MOVE 50                    TO SPH-MARGIN-X
               WHEN 3
                    MOVE 4200                  TO SPH-PAGE-Y
                    MOVE 50                    TO SPH-START-Y
                    MOVE 25                    TO SPH-START-X
                    MOVE 2550                  TO SPH-PAGE-X
                    MOVE 50                    TO SPH-MARGIN-X
               WHEN 26
                    MOVE 3507                  TO SPH-PAGE-Y
                    MOVE 50                    TO SPH-START-Y
                    MOVE 25                    TO SPH-START-X
                    MOVE 2480                  TO SPH-PAGE-X
                    MOVE 50                    TO SPH-MARGIN-X
               WHEN OTHER
                    MOVE WKM-WARN-0003         TO SPH-MNR
                    MOVE "wrong page size"     TO SPH-MPAR1
                    PERFORM Z4-WARNING
           END-EVALUATE.
           MOVE SPH-ESC1D (I-ESC)              TO SPH-PAGESIZE
           DIVIDE WKB-DPI-IST                  BY 2
                                           GIVING SPH-MARGIN-Y

           MULTIPLY SPH-PAGE-Y                 BY WKB-FAKTOR-XY
                                           GIVING SPH-PAGE-Y
           MULTIPLY SPH-PAGE-X                 BY WKB-FAKTOR-XY
                                           GIVING SPH-PAGE-X
           MULTIPLY SPH-MARGIN-X               BY WKB-FAKTOR-XY
                                           GIVING SPH-MARGIN-X
           MULTIPLY SPH-START-Y                BY WKB-FAKTOR-XY
                                           GIVING SPH-START-Y
           MULTIPLY SPH-START-X                BY WKB-FAKTOR-XY
                                           GIVING SPH-START-X

           MOVE ZERO                           TO SPH-X
           MOVE ZERO                           TO SPH-Y.
           MOVE SPH-VMI                        TO SPH-TEXT-Y.
       Z3A1-99.
           EXIT.


       Z3A2-PAGEORIENTATION SECTION.
      ******************************************************************
      * 0 - 3
      ******************************************************************
       Z3A2-10.
           IF
                SPS-DATA                        = WKA-JA
                PERFORM Z6-SEITE-RAUS
           END-IF

           EVALUATE SPH-ESC1D (I-ESC)
               WHEN 0
               WHEN 1
               WHEN 2
               WHEN 3
                    MOVE SPH-ESC1D (I-ESC)     TO SPH-ORIENTATION
               WHEN OTHER
                    MOVE WKM-WARN-0004         TO SPH-MNR
                    MOVE "wrong page orientation"
                                               TO SPH-MPAR1
                    PERFORM Z4-WARNING
           END-EVALUATE.

           MOVE DM-ORIENTATION                 TO DM2FIELDS
           IF
                SPH-ORIENTATION                 = 1
           OR   SPH-ORIENTATION                 = 3
                MOVE 2                         TO DM2ORIENTATION
           ELSE
                MOVE 1                         TO DM2ORIENTATION
           END-IF
           ADD  DM-PAPERLENGTH                 TO DM2FIELDS
           MOVE 2980                           TO DM2PAPERLENGTH
           IF
                SPH-PAGESIZE                    = 3
                MOVE 3500                      TO DM2PAPERLENGTH
           END-IF
           ADD  DM-PAPERWIDTH                  TO DM2FIELDS
           MOVE 2100                           TO DM2PAPERWIDTH
           MOVE 0                              TO DM2PAPERSIZE
           ADD  DM-PAPERSIZE                   TO DM2FIELDS
           MOVE X"00"                          TO DM2FORMNAME
           ADD  DM-FORMNAME                    TO DM2FIELDS
           CALL WINAPI "DocumentPropertiesA"
                                  USING
                                  BY VALUE 0                   SIZE 4
                                  BY VALUE SPH-HWND-PRINTER
                                  BY REFERENCE SPH-PRINTER2
                                  BY REFERENCE DEVMODE2
                                  BY REFERENCE DEVMODE2
                                  BY VALUE DM-IN-OUT-BUFFER    SIZE 4
                                  RETURNING SPH-RC
           MOVE "dev2-4 "                      TO PROTO-SATZ
           PERFORM Z40-PROP
           IF
                SPH-RC                         <= 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                MOVE WKM-WARN-0007             TO SPH-MNR
                MOVE "devmode2-4"              TO SPH-MPAR1
                MOVE SPH-RC                    TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR1 (12:)
                PERFORM Z4-WARNING
           END-IF.
           PERFORM Z38-FAKTOREN.
           PERFORM Z39-HMI-VMI.
       Z3A2-99.
           EXIT.


       Z3A3-RESOLUTION SECTION.
      ******************************************************************
      * RASTER GRAPHICS RESOLUTION
      ******************************************************************
       Z3A3-10.
           EVALUATE SPH-ESC1D (I-ESC)
               WHEN 75
               WHEN 100
               WHEN 150
               WHEN 200
               WHEN 300
               WHEN 600
                    MOVE SPH-ESC1D (I-ESC)     TO SPH-RESOLUTION
               WHEN OTHER
                    MOVE WKM-WARN-0005         TO SPH-MNR
                    MOVE "wrong resolution"    TO SPH-MPAR1
                    PERFORM Z4-WARNING
           END-EVALUATE.
       Z3A3-99.
           EXIT.


       Z3A4-TYPEFACE SECTION.
      ******************************************************************
      * (s  0T      Font Primary Typeface Line Printer
      * (s  1T      Font Primary Typeface Pica
      * (s  2T      Font Primary Typeface Elite
      * (s  3T      Font Primary Typeface Courier New
      * (s  5T      Font Primary Typeface Times Roman
      * (s  6T      Font Primary Typeface Letter Gothic
      * (s 17T      Font Primary Typeface Angana UPC
      * (s 31T      Font Primary Typeface Browallia UPC
      * (s 41T      Font Primary Typeface Cordia UPC
      * (s 47T      Font Primary Typeface Courier Proportional Thai
      * (s 51T      Font Primary Typeface Courier Mono thai
      * (s 52T      Font Primary Typeface Univers
      ******************************************************************
       Z3A4-19.
           PERFORM 11 TIMES
              IF
                   SPH-ESC1D (I-ESC)           >= 4096
                   SUBTRACT 4096             FROM SPH-ESC1D (I-ESC)
              END-IF
           END-PERFORM

           MOVE ZERO                           TO SPH-CODEPAGE
           EVALUATE SPH-ESC1D (I-ESC)
               WHEN 0
                    MOVE "LINE PRINTER"        TO SPH-LFFACENAME
               WHEN 1
                    MOVE "PICA"                TO SPH-LFFACENAME
               WHEN 2
                    MOVE "ELITE"               TO SPH-LFFACENAME
               WHEN 3
                    MOVE "COURIER NEW"         TO SPH-LFFACENAME
               WHEN 5
                    MOVE "TIMES ROMAN"         TO SPH-LFFACENAME
               WHEN 6
                    MOVE "LETTER GOTHIC"       TO SPH-LFFACENAME
               WHEN 17
                    MOVE "ANGSANAUPC"          TO SPH-LFFACENAME
                    MOVE 874                   TO SPH-CODEPAGE
               WHEN 31
                    MOVE "BROWALLIAUPC"        TO SPH-LFFACENAME
                    MOVE 874                   TO SPH-CODEPAGE
               WHEN 41
                    MOVE "CORDIAUPC"           TO SPH-LFFACENAME
                    MOVE 874                   TO SPH-CODEPAGE
               WHEN 47
                    MOVE "COURIER PROPORTIONALTHAI"
                                               TO SPH-LFFACENAME
                    MOVE 874                   TO SPH-CODEPAGE
               WHEN 51
                    MOVE "COURIER MONOTHAI"    TO SPH-LFFACENAME
                    MOVE 874                   TO SPH-CODEPAGE
               WHEN 52
                    MOVE "UNIVERS"             TO SPH-LFFACENAME
               WHEN 157
               WHEN 158
               WHEN 351
                    MOVE "SIMPLIFIED ARABIC"   TO SPH-LFFACENAME
                    MOVE 1256                  TO SPH-CODEPAGE
               WHEN 194
               WHEN 246
                    MOVE "ARIAL UNICODE MS"    TO SPH-LFFACENAME
                    MOVE 936                   TO SPH-CODEPAGE
               WHEN 260
                    MOVE "CYRILLIC"            TO SPH-LFFACENAME
               WHEN 261
                    MOVE "CYRILLIC TIMES"      TO SPH-LFFACENAME
               WHEN 1957
                    MOVE "WAM WAESCHE"         TO SPH-LFFACENAME
                    MOVE 500                   TO SPH-LFWEIGHT
                    MOVE ZERO                  TO SPH-PITCHANDFAMILY
                                                  SPH-LFWIDTH
                    MOVE WKA-JA                TO SPS-HEIGHT
                    MOVE WKA-NEIN              TO SPS-PITCH
               WHEN 1958
                    MOVE "CODE 128"            TO SPH-LFFACENAME
               WHEN 1959
                    MOVE "CODE EAN13"          TO SPH-LFFACENAME
               WHEN OTHER
                    MOVE "ARIAL"               TO SPH-LFFACENAME
           END-EVALUATE.

           IF
                SPH-CODEPAGE                    > ZERO
                MOVE SPH-CODEPAGE              TO SPH-CODEPAGE-LAST
           END-IF.

           MOVE DEFAULT-CHARSET                TO SPH-LFCHARSET
           MOVE DRAFT-QUALITY                  TO SPH-LFQUALITY.
       Z3A4-99.
           EXIT.


       Z3A5-STROKE-WEIGHT SECTION.
      ******************************************************************
      * PCL VON -7 BIS +7
      * WIN VON 0 BIS 900 IN 100-ER
      ******************************************************************
       Z3A5-10.
           IF
                SPH-ESC1D (I-ESC)               = ZERO
                MOVE 400                       TO SPH-LFWEIGHT
           ELSE
                IF
                     SPH-ESC1D (I-ESC)          < ZERO
                     COMPUTE SPH-LFWEIGHT ROUNDED
                                                = 400
                                                + 50
                                                * SPH-ESC1D (I-ESC)
                ELSE
                     COMPUTE SPH-LFWEIGHT ROUNDED
                                                = 400
                                                + 70
                                                * SPH-ESC1D (I-ESC)
                END-IF
           END-IF.
       Z3A5-99.
           EXIT.


       Z3A6-RECT-PRINT SECTION.
      ******************************************************************
      * 0 = BLACK
      * 1 = WHITE
      * 2 = SHADE
      * 3 = CROSS-HATCH
      * 4 = USER-DEFINED
      * 5 = CURRENT PATTERN
      * AKT-PATTERN:8=BLACK,15=WHITE 1-7=SHADES 9-14=cross-hatch
      ******************************************************************
       Z3A6-10.
           PERFORM Z15-CHECK-STARTPAGE.
           MOVE WKA-JA                         TO SPS-DATA.

           PERFORM Z12-ERM-PATTERN

           MOVE SPH-ESC1D (I-ESC)              TO SPH-RECT-FILL.

           MOVE SPH-Y                          TO SPH-2TOP
                                                  SPH-2BOTTOM
           MOVE SPH-X                          TO SPH-2LEFT
                                                  SPH-2RIGHT
           ADD  SPH-RECT-X                     TO SPH-2RIGHT
           ADD  SPH-RECT-Y                     TO SPH-2BOTTOM
           PERFORM Z9-VERSATZ-SPH-2RECT

           EVALUATE SPH-AKT-PATTERN
               WHEN ZERO
               WHEN 8
                    MOVE SPH-BRUSH-BLACK       TO SPH-BRUSH
                    MOVE SPH-BRUSH-WHITE       TO SPH-BRUSHI
                    PERFORM Z10-FILLRECT
               WHEN 15
                    MOVE SPH-BRUSH-WHITE       TO SPH-BRUSH
                    MOVE SPH-BRUSH-BLACK       TO SPH-BRUSHI
                    PERFORM Z10-FILLRECT
               WHEN 1 THRU 7
                    MOVE SPH-AKT-PATTERN       TO I-SH
                    PERFORM Z11-SHADERECT
               WHEN 9 THRU 14
                    MOVE SPH-AKT-PATTERN       TO I-SH
                    PERFORM Z11-SHADERECT
           END-EVALUATE.
       Z3A6-99.
           EXIT.


       Z3A7-PUSHPOP SECTION.
      ******************************************************************
      * CURSOR MERKEN/SETZEN: 20-ER TABELLE
      ******************************************************************
       Z3A7-10.
            IF
                SPH-ESC1D (I-ESC)               = ZERO
                IF
                     SPH-PUSH-AKT               < 20
                     ADD  1                    TO SPH-PUSH-AKT
                     MOVE SPH-X                TO SPH-PUSH-X
                                                  (SPH-PUSH-AKT)
                     MOVE SPH-Y                TO SPH-PUSH-Y
                                                  (SPH-PUSH-AKT)
                     MOVE SPH-TLEFT            TO SPH-PUSH-TX
                                                  (SPH-PUSH-AKT)
                     MOVE SPH-TTOP             TO SPH-PUSH-TY
                                                  (SPH-PUSH-AKT)
                     MOVE SPH-TEXT-Y           TO SPH-PUSH-TEXT-Y
                                                  (SPH-PUSH-AKT)
                END-IF
            END-IF.

            IF
                SPH-ESC1D (I-ESC)               = 1
                IF
                     SPH-PUSH-AKT               > ZERO
                AND  SPH-PUSH-AKT              <= 20
                     MOVE SPH-PUSH-X  (SPH-PUSH-AKT)
                                               TO SPH-X
                     MOVE SPH-PUSH-Y  (SPH-PUSH-AKT)
                                               TO SPH-Y
                     MOVE SPH-PUSH-TX (SPH-PUSH-AKT)
                                               TO SPH-TLEFT
                     MOVE SPH-PUSH-TY (SPH-PUSH-AKT)
                                               TO SPH-TTOP
                     MOVE SPH-PUSH-TEXT-Y (SPH-PUSH-AKT)
                                               TO SPH-TEXT-Y
                     SUBTRACT 1              FROM SPH-PUSH-AKT
                END-IF
            END-IF.
       Z3A7-99.
           EXIT.


       Z3A8-HMI SECTION.
      ******************************************************************
      * ANGABE HMI IN 1/120 INCH. WIR SETZEN UM IN PIXEL
      ******************************************************************
       Z3A8-10.
           COMPUTE SPH-HMI                      = SPH-ESC1D (I-ESC)
                                                * WKB-DPI-IST
                                                / 120
           IF
                SPH-HMI                         > ZERO
                MOVE WKA-JA                    TO SPS-PITCH
                COMPUTE SPH-PITCH ROUNDED       = WKB-DPI-IST
                                                / SPH-HMI
           ELSE
                MOVE 9999999                   TO SPH-PITCH
           END-IF.
       Z3A8-99.
           EXIT.


       Z4-WARNING SECTION.
      ******************************************************************
      * NUR NE WARNUNG PER DISPLAY
      ******************************************************************
       Z4-10.
           MOVE SPACE                          TO SPH-MPAR2
           SUBTRACT I-EV                     FROM I-EB
                                           GIVING I-L
           ADD  1                              TO I-L
           IF
                I-L                             > ZERO
           and  I-L                             < 1000
           AND  I-EV                            > ZERO
           AND  I-EV                            < 1000
                IF
                     I-L                        > 64
                     MOVE 64                   TO I-L
                END-IF
                MOVE SPH-SATZ (I-EV:I-L)       TO SPH-MPAR2 (2:)
                MOVE "EC"                      TO SPH-MPAR2 (1:2)
           END-IF.
           DISPLAY "YPCL2PR: " SPH-MNR " warning: " SPH-MPAR1
           DISPLAY "         " SPH-MPAR2.

           MOVE "warn:"                        TO PROTO-SATZ
           MOVE SPH-MNR                        TO PROTO-SATZ (7:4)
           MOVE SPH-MPAR1                      TO PROTO-SATZ (12:)
           MOVE SPH-MPAR2                      TO PROTO-SATZ (40:)
           PERFORM Z37-PROTO.
       Z4-99.
           EXIT.


       Z5-SETZEN-DEFAULTWERTE SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z5-10.
           PERFORM Z38-FAKTOREN.

           MOVE ZERO                           TO SPH-ORIENTATION
                                                  SPH-RECT-Y
                                                  SPH-RECT-X
                                                  SPH-RECT-FILL
                                                  SPH-RECT-SHADE
                                                  SPH-AKT-PATTERN
                                                  SPH-RASTER-X
           MOVE 75                             TO SPH-RESOLUTION
           MOVE ZERO                           TO SPH-ROTATION.
           MOVE 12                             TO SPH-HEIGHT.
           MOVE 10                             TO SPH-PITCH.

           MOVE LOW-VALUE                      TO SPH-LOGFONT
           MOVE SPH-DEF-FACENAME               TO SPH-LFFACENAME
           MOVE SPH-DEF-WEIGHT                 TO SPH-LFWEIGHT
           MOVE SPH-DEF-PITCHANDFAMILY         TO SPH-PITCHANDFAMILY

           PERFORM Z39-HMI-VMI

           MOVE ZERO                           TO SPH-X
           MOVE ZERO                           TO SPH-Y.
           MOVE SPH-VMI                        TO SPH-TEXT-Y.


      *-----------------------------------------------------------------
      * DEVICE-DEFAULT-FONT
      *-----------------------------------------------------------------
           IF
                SPS-STATUS                      = SPACE
      *-----------------------------------------------------------------
      * OEM-FIXED-FONT         VALUE 10.
      * ANSI-FIXED-FONT        VALUE 11.
      * ANSI-VAR-FONT          VALUE 12.
      * SYSTEM-FONT            VALUE 13.
      * DEVICE-DEFAULT-FONT    VALUE 14.
      * DEFAULT-GUI-FONT       VALUE 17.
      *-----------------------------------------------------------------
                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 10 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 11 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 12 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 13 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 14 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE 17 SIZE 4
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                MOVE SPACE TO SPH-TEXT
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L

                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE DEVICE-DEFAULT-FONT
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L
                CALL WINAPI "GetTextMetricsA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-TEXTMETRIC
                                  RETURNING SPH-RC
                IF
                     SPH-DEF-FACENAME           = SPACE
                     MOVE SPH-TEXT             TO SPH-DEF-FACENAME
                     IF
                          SPH-TM-AVECHARWIDTH   = SPH-TM-MAXCHARWIDTH
                          MOVE 1               TO SPH-DEF-PITCHANDFAMILY
                     END-IF
                END-IF
                MOVE SPH-DEF-FACENAME          TO SPH-LFFACENAME
                MOVE SPH-DEF-WEIGHT            TO SPH-LFWEIGHT
                MOVE SPH-DEF-PITCHANDFAMILY    TO SPH-PITCHANDFAMILY
                MOVE ZERO                      TO SPH-LFPITCHANDFAMILY
                PERFORM Z14-FONT
           END-IF.

           MOVE SPACE                          TO SPS-POSI-Y

           COMPUTE SPH-MIN-Y                    = 0
                                                - SPH-P-YR
                                                - SPH-MARGIN-Y.
       Z5-99.
           EXIT.


       Z6-SEITE-RAUS SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z6-10.
           IF
                SPS-STATUS                      = SPACE
           AND  SPS-TEST                        = "1"
                MOVE SPACE                     TO SPS-TEST
                PERFORM Z19-U-TEST
           END-IF.
           IF
                SPS-STATUS                      = SPACE
           AND  SPS-TEST                        = "2"
                MOVE SPACE                     TO SPS-TEST
                PERFORM Z20-U-TEST
           END-IF.

           MOVE ZERO                           TO SPH-3TOP
                                                  SPH-3LEFT
           IF
                SPH-P-X                         > SPH-P-Y
                MOVE SPH-P-X                   TO SPH-3RIGHT
                                                  SPH-3BOTTOM
           ELSE
                MOVE SPH-P-Y                   TO SPH-3RIGHT
                                                  SPH-3BOTTOM
           END-IF
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-3RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC.

           MOVE ZERO                           TO SPH-X-DIFF
                                                  SPH-Y-DIFF
      *-----------------------------------------------------------------
      * LINKS/RECHTS VERSCHIEBEN, WENN ZU BREIT
      * ORIENTATION 0=PORTRAIT
      *-----------------------------------------------------------------
           IF
                SPH-X-SEITE-B                   > SPH-RES-X
                IF
                     SPH-X-SEITE-V              > ZERO
                     IF
                          (SPH-X-SEITE-B - SPH-RES-X)
                                                > SPH-X-SEITE-V
                          MOVE SPH-X-SEITE-V   TO SPH-X-DIFF
                     ELSE
                          COMPUTE SPH-X-DIFF    = SPH-X-SEITE-B
                                                - SPH-RES-X
                     END-IF
                END-IF
           END-IF
           IF
                SPH-Y-SEITE-B                   > SPH-RES-Y
                IF
                     SPH-Y-SEITE-V              > ZERO
                     IF
                          (SPH-Y-SEITE-B - SPH-RES-Y)
                                                > SPH-Y-SEITE-V
                          MOVE SPH-Y-SEITE-V   TO SPH-Y-DIFF
                     ELSE
                          COMPUTE SPH-Y-DIFF    = SPH-Y-SEITE-B
                                                - SPH-RES-Y
                     END-IF
                END-IF
           END-IF
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-X-DIFF
                                  BY VALUE SPH-Y-DIFF
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

           MOVE SPACE                          TO SPS-DATA
           PERFORM Z16-SEITE-KOMPLETT
           CALL WINAPI "EndPage"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-RC.
           IF
                SPH-RC                         <= 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                MOVE WKM-2176                  TO SPH-MNR
                MOVE "EndPage2"                TO SPH-MPAR1
                MOVE SPH-RC                    TO SPH-Z10
                MOVE SPH-Z10-A                 TO SPH-MPAR2
                PERFORM Z4-WARNING
           END-IF.
       Z6-99.
           EXIT.


       Z7-ERROR SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z7-10.
           MOVE WKA-NEIN                       TO SPS-STATUS.
           DISPLAY "YPCL2PR: " SPH-MNR " error: " SPH-MPAR1
           DISPLAY "         " SPH-MPAR2

           MOVE SPH-MNR                        TO YPCL2PR-MNR
           MOVE SPH-MPAR1                      TO YPCL2PR-MPAR1
           MOVE SPH-MPAR2                      TO YPCL2PR-MPAR2
           MOVE SPH-MPAR3                      TO YPCL2PR-MPAR3.

           MOVE "error:"                       TO PROTO-SATZ
           MOVE SPH-MNR                        TO PROTO-SATZ (7:4)
           MOVE SPH-MPAR1                      TO PROTO-SATZ (12:)
           MOVE SPH-MPAR2                      TO PROTO-SATZ (40:)
           PERFORM Z37-PROTO.
       Z7-99.
           EXIT.


       Z8-GETDEVICECAPS SECTION.
      ******************************************************************
      * EINSTELLUNGEN ABFRAGEN
      ******************************************************************
       Z8-10.
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE RASTERCAPS Size 4
                                  RETURNING SPH-RC
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE PHYSICALWIDTH size 4
                                  RETURNING SPH-P-X
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE PHYSICALHEIGHT size 4
                                  RETURNING SPH-P-Y
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SCALINGFACTORX size 4
                                  RETURNING SPH-RC
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SCALINGFACTORY size 4
                                  RETURNING SPH-RC
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE HORZRES size 4
                                  RETURNING SPH-RES-X
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE VERTRES size 4
                                  RETURNING SPH-RES-Y
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE PHYSICALOFFSETX size 4
                                  RETURNING SPH-P-XR
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE PHYSICALOFFSETY size 4
                                  RETURNING SPH-P-YR.
           CALL WINAPI "GetDeviceCaps"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE LOGPIXELSX size 4
                                  RETURNING SPH-LPIX-X.
       Z8-99.
           EXIT.


       Z9-VERSATZ-SPH-2RECT SECTION.
      ******************************************************************
      * GENERELLER VERSSATZ AUF X, Y
      ******************************************************************
       Z9-10.
           COMPUTE SPH-2TOP                     = SPH-2TOP
                                                + SPH-MARGIN-Y
                                                - SPH-START-Y
                                                - WKB-Y-MINUS
           COMPUTE SPH-2BOTTOM                  = SPH-2BOTTOM
                                                + SPH-MARGIN-Y
                                                - SPH-START-Y
                                                - WKB-Y-MINUS
           COMPUTE SPH-2LEFT                    = SPH-2LEFT
                                                + SPH-START-X
                                                - WKB-X-MINUS
           COMPUTE SPH-2RIGHT                   = SPH-2RIGHT
                                                + SPH-START-X
                                                - WKB-X-MINUS.
           PERFORM Z34-SEITE-MIN-MAX.
       Z9-99.
           EXIT.


       Z10-FILLRECT SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z10-10.
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH.
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSHI.
       Z10-99.
           EXIT.


       Z11-SHADERECT SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z11-10.
      *-----------------------------------------------------------------
      * BITMAP LADEN
      *-----------------------------------------------------------------
           IF
                SPH-SHADE-HBMP (I-SH)           = ZERO
                MOVE I-SH                      TO SPH-N2
                MOVE WKB-SHADE-B (I-SH)        TO I-X
                IF
                     SPH-TT                 NOT = SPACE
                     STRING SPH-LWT
                            "\"
                            SPH-TT
                            "\TEMP\INTEX_SHADE_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                ELSE
                     STRING "INTEX_SHADE_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                END-IF
                CALL WINAPI "LoadImageA"
                                  USING
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  BY VALUE 0       SIZE 4
                                  BY VALUE I-X
                                  BY VALUE I-X
                                  BY VALUE H"8010" SIZE 4
                                  RETURNING SPH-SHADE-HBMP (I-SH)
                IF
                     SPH-SHADE-HBMP (I-SH)      = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                CALL WINAPI "CreatePatternBrush"
                                  USING
                                  BY VALUE SPH-SHADE-HBMP   (I-SH)
                                  RETURNING SPH-BRUSH-SHADE (I-SH)
                IF
                     SPH-BRUSH-SHADE (I-SH)     = 0
                     CALL WINAPI "GetLastError"
                                      RETURNING SPH-RC
                END-IF
           END-IF.

      *-----------------------------------------------------------------
      * BITMAP LADEN INVERS
      *-----------------------------------------------------------------
           IF
                SPH-SHADEI-HBMP (I-SH)          = ZERO
                MOVE I-SH                      TO SPH-N2
                MOVE WKB-SHADE-B (I-SH)        TO I-X
                IF
                     SPH-TT                 NOT = SPACE
                     STRING SPH-LWT
                            "\"
                            SPH-TT
                            "\TEMP\INTEX_SHADEI_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                ELSE
                     STRING "INTEX_SHADEI_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                END-IF
                CALL WINAPI "LoadImageA"
                                  USING
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  BY VALUE 0       SIZE 4
                                  BY VALUE I-X
                                  BY VALUE I-X
                                  BY VALUE H"8010" SIZE 4
                                  RETURNING SPH-SHADEI-HBMP (I-SH)
                IF
                     SPH-SHADEI-HBMP (I-SH)     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                CALL WINAPI "CreatePatternBrush"
                                  USING
                                  BY VALUE SPH-SHADEI-HBMP   (I-SH)
                                  RETURNING SPH-BRUSH-SHADEI (I-SH)
                IF
                     SPH-BRUSH-SHADEI (I-SH)    = 0
                     CALL WINAPI "GetLastError"
                                      RETURNING SPH-RC
                END-IF
           END-IF.

           IF
                SPH-BRUSH-SHADE  (I-SH)     NOT = ZERO
           AND  SPH-BRUSH-SHADEI (I-SH)     NOT = ZERO
                SUBTRACT SPH-2LEFT           FROM SPH-2RIGHT
                                           GIVING SPH-W-X
                SUBTRACT SPH-2TOP            FROM SPH-2BOTTOM
                                           GIVING SPH-W-Y

                PERFORM Z18-SCHATTEN
           END-IF.
       Z11-99.
           EXIT.


       Z12-ERM-PATTERN SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z12-10.
           EVALUATE SPH-ESC1D (I-ESC)
               WHEN 0
                    MOVE SPH-BRUSH-BLACK       TO SPH-BRUSH
                    MOVE SPH-BRUSH-WHITE       TO SPH-BRUSHI
                    MOVE 8                     TO SPH-AKT-PATTERN
               WHEN 1
                    MOVE SPH-BRUSH-WHITE       TO SPH-BRUSH
                    MOVE SPH-BRUSH-BLACK       TO SPH-BRUSHI
                    MOVE 15                    TO SPH-AKT-PATTERN
               WHEN 2
                    PERFORM Z12A-SHADE
               WHEN 3
                    PERFORM Z12B-CROSS
               WHEN 4
               WHEN 5
                    CONTINUE
           END-EVALUATE.
       Z12-99.
           EXIT.


       Z12A-SHADE SECTION.
      ******************************************************************
      * 0 = WEISS
      * 1 - 9 = DIE 8 SCHATTIERUNGEN
      ******************************************************************
       Z12A-10.
           MOVE ZERO                           TO I-SH
           EVALUATE SPH-RECT-SHADE
               WHEN 1  THRU 2
                    MOVE 1                     TO I-SH
               WHEN 3  THRU 10
                    MOVE 2                     TO I-SH
               WHEN 11 THRU 20
                    MOVE 3                     TO I-SH
               WHEN 21 THRU 35
                    MOVE 4                     TO I-SH
               WHEN 36 THRU 55
                    MOVE 5                     TO I-SH
               WHEN 56 THRU 80
                    MOVE 6                     TO I-SH
               WHEN 81 THRU 99
                    MOVE 7                     TO I-SH
               WHEN 100
                    MOVE 8                     TO I-SH
           END-EVALUATE.
           MOVE I-SH                           TO SPH-AKT-PATTERN.
       Z12A-99.
           EXIT.


       Z12B-CROSS SECTION.
      ******************************************************************
      * KENNZEICHEN SETZEN
      ******************************************************************
       Z12B-10.
           MOVE ZERO                           TO I-SH
           EVALUATE SPH-RECT-SHADE
               WHEN 1 THRU 6
                    MOVE SPH-RECT-SHADE        TO I-SH
                    ADD  8                     TO I-SH
           END-EVALUATE.
           MOVE I-SH                           TO SPH-AKT-PATTERN.
       Z12B-99.
           EXIT.


       Z13-TEXTOUT SECTION.
      ******************************************************************
      * TEXTAUSGABE
      ******************************************************************
       Z13-10.
           COMPUTE SPH-TLEFT                    = SPH-X
                                                + SPH-START-X
                                                - WKB-X-MINUS
           IF
                SPS-POSI-Y                      = WKA-JA
                COMPUTE SPH-TTOP                = SPH-TEXT-Y
                                                + SPH-MARGIN-Y
                                                - SPH-START-Y
                                                - SPH-TM-ASCENT
                                                - WKB-Y-MINUS
           ELSE
                COMPUTE SPH-TTOP                = SPH-TEXT-Y
                                                + SPH-MARGIN-Y
                                                - SPH-START-Y
                                                - SPH-TM-LFHEIGHT * 0,75
                                                - WKB-Y-MINUS
           END-IF


      *-----------------------------------------------------------------
      * UTF
      *-----------------------------------------------------------------
           IF
                SPH-CODEPAGE                NOT = ZERO
                CALL WINAPI "TextOutW"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE I-L
                CALL WINAPI "TextOutW"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE I-L
                CALL WINAPI 'GetTextExtentPoint32W'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TCPPL
                PERFORM Z35-SEITE-MIN-MAX
                IF
                     SPH-PITCHANDFAMILY              = 1
                AND  SPH-PITCH                       > ZERO
                AND  SPH-CODEPAGE                NOT = 936
                     COMPUTE SPH-X                   = SPH-X
                                                     + SPH-HMI * I-L
                ELSE
                     ADD  SPH-TCX              TO SPH-X
                END-IF
           ELSE
      *-----------------------------------------------------------------
      * #UTF
      *-----------------------------------------------------------------
                IF
                     SPH-PITCHANDFAMILY         = 1
                AND  SPH-PITCH                  > ZERO
                AND  I-L                        = 1
                     CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-SATZ (I-C:)
                                  BY VALUE 1 SIZE 4
                                  BY REFERENCE SPH-TCPPL
                     COMPUTE SPH-TLEFT          = SPH-TLEFT
                                                + (SPH-HMI - SPH-TCX)
                                                / 2
                     PERFORM Z35-SEITE-MIN-MAX
                     CALL WINAPI "OemToCharBuffA"
                                  USING
                                  BY REFERENCE SPH-SATZ (I-C:)
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE     1 SIZE 4
                     CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE 1 SIZE 4
                     ADD  SPH-HMI              TO SPH-X
                     CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE 1 SIZE 4
                ELSE
                     CALL WINAPI "OemToCharBuffA"
                                  USING
                                  BY REFERENCE SPH-SATZ (I-C:)
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE     I-L
                     CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE I-L
                     CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-TLEFT
                                  BY VALUE SPH-TTOP
                                  BY REFERENCE SPH-TEXT-UTF
                                  BY VALUE I-L
                     CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-SATZ (I-C:)
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TCPPL
                     ADD  SPH-TCX              TO SPH-X
                     PERFORM Z35-SEITE-MIN-MAX
                END-IF
           END-IF.
       Z13-99.
           EXIT.


       Z14-FONT SECTION.
      ******************************************************************
      * FONT ERMITTELN
      * SPH-HEIGHT     1 = 1/72 INCH
      * SPH-PITCH        = CHAR / INCH
      ******************************************************************
       Z14-10.
           PERFORM VARYING I1 FROM 32 BY -1
                     UNTIL I1 < 1
              IF
                   SPH-LFFACENAME (I1:1)    NOT = SPACE
              AND  SPH-LFFACENAME (I1:1)    NOT = X"00"
                   MOVE 1                      TO I1
              ELSE
                   MOVE X"00"                  TO SPH-LFFACENAME (I1:1)
              END-IF
           END-PERFORM.

      *-----------------------------------------------------------------
      * SEITENVERHAELTNIS TEXT SPH-EM
      *-----------------------------------------------------------------
           PERFORM Z14B-LOE-FONT

           MOVE ZERO                           TO SPH-LFWIDTH
           IF
                SPH-PITCHANDFAMILY              = 1
           AND  SPH-PITCH                       > ZERO
                COMPUTE SPH-LFHEIGHT ROUNDED    = 12
                                                * WKB-DPI-IST
                                                / 72
           ELSE
                COMPUTE SPH-LFHEIGHT ROUNDED    = SPH-HEIGHT
                                                * WKB-DPI-IST
                                                / 72
           END-IF

           CALL WINAPI 'CreateFontIndirectA'
                                  USING
                                  BY REFERENCE SPH-LOGFONT
                                  RETURNING SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMP1
                                 BY VALUE SPH-FONT.
           CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L.
           CALL WINAPI "GetTextMetricsA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-TEXTMETRIC
                                  RETURNING SPH-RC.
           CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE "A"
                                  BY VALUE 1 SIZE 4
                                  BY REFERENCE SPH-TCPPL
           DIVIDE SPH-TCX                      BY SPH-TCY
                                           GIVING SPH-EM
           DIVIDE SPH-TM-AVECHARWIDTH          BY SPH-TCY
                                           GIVING SPH-EM

      *-----------------------------------------------------------------
      * SEITENVERHAELTNIS TEXT SPH-EMF FIXED
      *-----------------------------------------------------------------
           PERFORM Z14B-LOE-FONT

           MOVE ZERO                           TO SPH-LFWIDTH
           MOVE 1                              TO SPH-LFPITCHANDFAMILY
           COMPUTE SPH-LFHEIGHT ROUNDED         = 12
                                                * WKB-DPI-IST
                                                / 72

           CALL WINAPI 'CreateFontIndirectA'
                                  USING
                                  BY REFERENCE SPH-LOGFONT
                                  RETURNING SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMP1
                                 BY VALUE SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMPI
                                 BY VALUE SPH-FONT.
           CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L.
           CALL WINAPI "GetTextMetricsA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-TEXTMETRIC
                                  RETURNING SPH-RC.
           CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE "A"
                                  BY VALUE 1 SIZE 4
                                  BY REFERENCE SPH-TCPPL
           DIVIDE SPH-TCX                      BY SPH-TCY
                                           GIVING SPH-EMF

      *-----------------------------------------------------------------
      * NORMALLAUF
      *-----------------------------------------------------------------
           MOVE ZERO                           TO SPH-LFHEIGHT
                                                  SPH-LFWIDTH
                                                  SPH-LFPITCHANDFAMILY
           PERFORM Z14B-LOE-FONT

           if
                SPH-PITCH                       = 16
           AND  SPS-PITCH                       = WKA-JA
           AND  SPH-HEIGHT                      = 7
           AND  SPS-HEIGHT                      = WKA-JA
           AND  SPH-PITCHANDFAMILY              = 0
      *!!!!!!!debug
                move 1 to i1
           end-if

      *-----------------------------------------------------------------
      * 1 = FIXED
      *-----------------------------------------------------------------
           IF
                SPH-PITCHANDFAMILY              = 1
           AND  SPH-PITCH                       > ZERO
           AND  SPS-PITCH                       = WKA-JA
                COMPUTE SPH-LFWIDTH ROUNDED     = WKB-DPI-IST
                                                / SPH-PITCH
                MOVE SPH-LFWIDTH               TO SPH-HMI
                IF
                     SPS-HEIGHT                 = WKA-JA
                     COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-HEIGHT
                                                * WKB-DPI-IST
                                                / 72
                ELSE
                     COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-LFWIDTH
                                                / SPH-EMF
                END-IF
                MULTIPLY SPH-LFHEIGHT          BY -1
                                           GIVING SPH-LFHEIGHT
                MULTIPLY SPH-LFWIDTH           BY 0,8
                                           GIVING SPH-LFWIDTH
           ELSE
                IF
                     SPS-HEIGHT                 = WKA-JA
                OR   SPS-PITCH              NOT = WKA-JA
                     COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-HEIGHT
                                                * WKB-DPI-IST
                                                / 72
                     MULTIPLY SPH-LFHEIGHT     BY -1
                                           GIVING SPH-LFHEIGHT

                ELSE
                     MOVE ZERO                 TO SPH-LFHEIGHT
                END-IF
                IF
                     SPS-PITCH                  = WKA-JA
                     COMPUTE SPH-LFWIDTH ROUNDED
                                                = WKB-DPI-IST
                                                / SPH-PITCH
                ELSE
                     MOVE ZERO                 TO SPH-LFWIDTH
                END-IF
                IF
                     SPH-LFHEIGHT               = ZERO
                     IF
                          SPH-HEIGHT        NOT = ZERO
                          COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-HEIGHT
                                                * WKB-DPI-IST
                                                / 72
                          MULTIPLY SPH-LFHEIGHT
                                               BY -1
                                           GIVING SPH-LFHEIGHT
                     ELSE
                          IF
                               SPH-LFWIDTH  NOT = ZERO
                               COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-LFWIDTH
                                                / SPH-EMF
                          ELSE
                               COMPUTE SPH-LFHEIGHT ROUNDED
                                                = SPH-HMI
                                                / SPH-EMF
                          END-IF
                     END-IF
                END-IF
           END-IF.


           MOVE WKA-JA                         TO SPS-GROESSE-MIST
           MOVE 0                              TO I-FEHL
           MOVE SPH-LFWIDTH                    TO SPH-FONT-X
                                                  SPH-FONT-O-X
      *-----------------------------------------------------------------
      * THAI
      *-----------------------------------------------------------------
           IF
                SPH-CODEPAGE                    = 874
                MULTIPLY SPH-FONT-O-X          BY 3
                                           GIVING SPH-FONT-O-X
           END-IF
           PERFORM UNTIL SPS-GROESSE-MIST   NOT = WKA-JA
                      OR I-FEHL                 > WKB-MAX-TRY
              PERFORM Z14A-CREATEFONT
              ADD  1                           TO I-FEHL
              IF
                   SPS-GROESSE-MIST             = WKA-JA
                   IF
                        SPH-FONT-X              > (SPH-FONT-O-X / 2)
                   AND  SPH-FONT-X              > ZERO
                   AND  SPH-PITCH               > ZERO
                   AND  SPS-PITCH               = WKA-JA
                        SUBTRACT 1           FROM SPH-FONT-X
                   ELSE
                        MOVE WKM-WARN-0006     TO SPH-MNR
                        MOVE "wrong font"      TO SPH-MPAR1
                        MOVE SPH-LFFACENAME    TO SPH-MPAR2
                        PERFORM Z4-WARNING
                        MOVE WKB-MAX-TRY       TO I-FEHL
                        ADD  1                 TO I-FEHL
                   END-IF
              END-IF
           END-PERFORM.
       Z14-99.
           EXIT.


       Z14A-CREATEFONT SECTION.
      ******************************************************************
      * FONT HOLEN
      ******************************************************************
       Z14A-10.
           PERFORM Z14B-LOE-FONT

           MOVE SPH-FONT-X                     TO SPH-LFWIDTH
           CALL WINAPI 'CreateFontIndirectA'
                                  USING
                                  BY REFERENCE SPH-LOGFONT
                                  RETURNING SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMP1
                                 BY VALUE SPH-FONT.
           CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMPI
                                 BY VALUE SPH-FONT.
           MOVE SPACE                          TO SPH-TEXT
           CALL WINAPI "GetTextFaceA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE 128 SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  RETURNING I-L.
           CALL WINAPI "GetTextMetricsA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-TEXTMETRIC
                                  RETURNING SPH-RC.
           CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE "A"
                                  BY VALUE 1 SIZE 4
                                  BY REFERENCE SPH-TCPPL

      *-----------------------------------------------------------------
      * 0 = PROPORTIONAL
      * 1 = FIXED
      * ERST MAL GLEICH ABFRAGEN...
      *-----------------------------------------------------------------
           IF
                SPH-PITCHANDFAMILY              = 0
                IF
                     SPH-TCX                    > SPH-FONT-O-X
                AND  SPH-FONT-O-X               > ZERO
                AND  SPH-TM-AVECHARWIDTH    NOT = SPH-TM-MAXCHARWIDTH
                     MOVE WKA-JA               TO SPS-GROESSE-MIST
                ELSE
                     MOVE WKA-NEIN             TO SPS-GROESSE-MIST
                END-IF
           ELSE
                IF
                     SPH-TCX                    > SPH-FONT-O-X
                AND  SPH-FONT-O-X               > ZERO
                AND  SPH-TM-AVECHARWIDTH    NOT = SPH-TM-MAXCHARWIDTH
                     MOVE WKA-JA               TO SPS-GROESSE-MIST
                ELSE
                     MOVE WKA-NEIN             TO SPS-GROESSE-MIST
                END-IF
           END-IF.
       Z14A-99.
           EXIT.


       Z14B-LOE-FONT SECTION.
      ******************************************************************
      * FONT LOESCHEN
      ******************************************************************
       Z14B-10.
           IF
                SPH-FONT                    NOT = ZERO
                CALL WINAPI "GetStockObject"
                                 USING
                                 BY VALUE DEVICE-DEFAULT-FONT
                                 RETURNING SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMP1
                                 BY VALUE SPH-FONTX
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMPI
                                 BY VALUE SPH-FONTX
                CALL WINAPI 'DeleteObject'
                                 USING
                                 BY VALUE SPH-FONT
                                 RETURNING SPH-RC
                MOVE ZERO                      TO SPH-FONT
           END-IF.
       Z14B-99.
           EXIT.


       Z15-CHECK-STARTPAGE SECTION.
      ******************************************************************
      * CHECK OB NOCH KEINE DATEN AUF DER SEITE: WENN NIX, DANN
      * STARTPAGE SETZEN
      ******************************************************************
       Z15-10.
           IF
                SPS-DATA-GES                    = SPACE
                MOVE WKA-JA                    TO SPS-DATA-GES
                MOVE "WINSPOOL"                TO SPH-DRIVER
                MOVE X"00"                     TO SPH-DRIVER (9:1)
                CALL WINAPI "CreateDCA"
                                  USING
                                  BY REFERENCE SPH-DRIVER
                                  BY REFERENCE SPH-PRINTER2
                                  BY VALUE 0               SIZE 4
                                  BY REFERENCE DEVMODE2
                                  RETURNING SPH-HDC
                IF
                     SPH-HDC                = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-WARN-0007        TO SPH-MNR
                     MOVE "createdc"           TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR1 (12:)
                     PERFORM Z4-WARNING
                END-IF
                PERFORM Z8-GETDEVICECAPS

                EVALUATE TRUE
                   WHEN YPCL2PR-RESOLUTION      > ZERO
                        MOVE YPCL2PR-RESOLUTION
                                               TO WKB-DPI-IST
                   WHEN DM2YRESOLUTION          > ZERO
                        MOVE DM2YRESOLUTION    TO WKB-DPI-IST
                   WHEN OTHER
                        MOVE 600               TO WKB-DPI-IST
                END-EVALUATE
                PERFORM Z38-FAKTOREN
                PERFORM Z39-HMI-VMI

                CALL WINAPI "StartDocA"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE DOCINFO
                                  RETURNING SPH-PRINTJOB
                IF
                     SPH-PRINTJOB               = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "StartDoc"           TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                IF
                     SPH-HDC-COMPI              = ZERO
                     CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPI
                     IF
                          SPH-HDC-COMPI         = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "CreCompDCi"    TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
                IF
                     SPH-BMP-COMPI              = ZERO
                     CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  RETURNING SPH-BMP-COMPI
                     IF
                          SPH-BMP-COMPI         = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "CreCompBMPi"   TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
                CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-BMP-COMPI
                                  RETURNING SPH-RC

                IF
                     SPH-HDC-COMP2              = ZERO
                     CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMP2
                     IF
                          SPH-HDC-COMP2         = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "CreCompDC2"    TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
                IF
                     SPH-BMP-COMP2              = ZERO
                     CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMP2
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  RETURNING SPH-BMP-COMP2
                     IF
                          SPH-BMP-COMP2         = 0
                          CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                          MOVE WKM-2176        TO SPH-MNR
                          MOVE "CreCompBMP2"   TO SPH-MPAR1
                          MOVE SPH-RC          TO SPH-Z10
                          MOVE SPH-Z10-A       TO SPH-MPAR2
                          PERFORM Z7-ERROR
                     END-IF
                END-IF
                CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMP2
                                  BY VALUE SPH-BMP-COMP2
                                  RETURNING SPH-RC

                CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMP3
                IF
                     SPH-HDC-COMP3              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompDC3"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMP4
                IF
                     SPH-HDC-COMP4              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompDC4"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  RETURNING SPH-BMP-COMP4
                IF
                     SPH-BMP-COMP4              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompBMP4"        TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPS
                IF
                     SPH-HDC-COMPS              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompDCs"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  RETURNING SPH-BMP-COMPS
                IF
                     SPH-BMP-COMPS              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompBMPs"        TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF
                CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPS
                                  BY VALUE SPH-BMP-COMPS
                                  RETURNING SPH-RC

                CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMP1
                IF
                     SPH-HDC-COMP1              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompDC1"         TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  RETURNING SPH-BMP-COMP1
                IF
                     SPH-BMP-COMP1              = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "CreCompBMP1"        TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF
                CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-BMP-COMP1
                                  RETURNING SPH-RC

                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC
                                 BY VALUE SPH-FONT
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMP1
                                 BY VALUE SPH-FONT
                CALL WINAPI "SelectObject"
                                 USING
                                 BY VALUE SPH-HDC-COMPI
                                 BY VALUE SPH-FONT

                CALL WINAPI 'SetBkMode'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE TRANSPARENT SIZE 4
                CALL WINAPI 'SetBkMode'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE TRANSPARENT SIZE 4
                CALL WINAPI 'SetBkMode'
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE TRANSPARENT SIZE 4

                CALL WINAPI 'SetTextColor'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SPH-COL-BLACK
                CALL WINAPI 'SetTextColor'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-COL-BLACK
                CALL WINAPI 'SetTextColor'
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-COL-WHITE

                CALL WINAPI 'SetBkColor'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY VALUE SPH-COL-WHITE
                CALL WINAPI 'SetBkColor'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-COL-WHITE
                CALL WINAPI 'SetBkColor'
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-COL-BLACK

                MOVE ZERO                      TO SPH-2TOP
                                                  SPH-2LEFT
                MOVE SPH-P-X                   TO SPH-2RIGHT
                MOVE SPH-P-Y                   TO SPH-2BOTTOM
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-BLACK
                                  RETURNING SPH-RC
           END-IF


           IF
                SPS-DATA                        = SPACE
                MOVE ZERO                      TO SPH-X-SEITE-B
                                                  SPH-Y-SEITE-B
                MOVE 999999999                 TO SPH-X-SEITE-V
                                                  SPH-Y-SEITE-V
                CALL WINAPI "StartPage"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-RC
                IF
                     SPH-RC                    <= 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "StartPage"          TO SPH-MPAR1
                     MOVE SPH-RC               TO SPH-Z10
                     MOVE SPH-Z10-A            TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF

                MOVE ZERO                      TO SPH-2TOP
                                                  SPH-2LEFT
                MOVE SPH-P-X                   TO SPH-2RIGHT
                MOVE SPH-P-Y                   TO SPH-2BOTTOM
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC
                CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-BLACK
                                  RETURNING SPH-RC
           END-IF.
       Z15-99.
           EXIT.


       Z16-SEITE-KOMPLETT SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z16-10.

       Z16-99.
           EXIT.


       Z18-SCHATTEN SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z18-10.
           SUBTRACT SPH-2LEFT                FROM SPH-2RIGHT
                                           GIVING SPH-W-X
           SUBTRACT SPH-2TOP                 FROM SPH-2BOTTOM
                                           GIVING SPH-W-Y

           PERFORM Z29-STORE
      *-----------------------------------------------------------------
      * BITMAP, DC ...
      *-----------------------------------------------------------------
           PERFORM Z23-LOE-COMPW1
           PERFORM Z24-CRE-COMPW1.

      *-----------------------------------------------------------------
      * RECT IN COMPW1 SICHERN
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCINVERT SIZE 4
                                  RETURNING SPH-RC.

      *-----------------------------------------------------------------
      * GETDIBITS
      *-----------------------------------------------------------------
                MOVE LOW-VALUE                 TO BITMAPINFOHEADER
                MOVE 40                        TO BISIZE
                MOVE SPH-W-X                   TO BIWIDTH
                MOVE SPH-W-Y                   TO BIHEIGHT
                MOVE 1                         TO BIPLANES
                MOVE 1                         TO BIBITCOUNT
                MOVE X"FFFFFF0000000000"
                                               TO RGBQUADS
                CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-BMP-COMPW1
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                MOVE LOW-VALUE                 TO BIGBUFF1
                CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-BMP-COMPW1
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF1
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC

           PERFORM VARYING I1 FROM 1 BY 1
                     UNTIL I1 > BISIZEIMAGE
              IF
                   BIGBUFF1 (I1:1)              = X"00"
                   MOVE 1 TO I4
              END-IF
              IF
                   BIGBUFF1 (I1:1)          NOT = X"00"
                   MOVE 1 TO I4
              END-IF
           END-PERFORM.

      *-----------------------------------------------------------------
      * RASTER
      *-----------------------------------------------------------------
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-SHADE (I-SH)
                                  RETURNING SPH-RC.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

           MOVE LOW-VALUE                      TO BIGBUFF2
           CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-BMP-COMPW1
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF2
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC

           PERFORM VARYING I1 FROM 1 BY 1
                     UNTIL I1 > BISIZEIMAGE
              IF
                   BIGBUFF2 (I1:1)              = X"00"
                   MOVE 1 TO I4
              END-IF
              IF
                   BIGBUFF2 (I1:1)          NOT = X"00"
                   MOVE 1 TO I4
              END-IF
              IF
                   BIGBUFF1 (I1:1)          NOT = BIGBUFF2 (I1:1)
                   PERFORM Z18A-DIFF
              END-IF
           END-PERFORM.

           CALL WINAPI "SetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-BMP-COMPW1
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF2
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
           IF
                SPH-RC                          = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF.

           PERFORM Z30-RESTORE.

           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

           PERFORM Z23-LOE-COMPW1.
       Z18-99.
           EXIT.


       Z18A-DIFF SECTION.
      ******************************************************************
      * DIE BITMAP FAENGT VON HINTEN AN!
      ******************************************************************
       Z18A-10.
           MOVE BIGBUFF1 (I1:1)                TO SPH-A1-A
           MOVE BIGBUFF2 (I1:1)                TO SPH-B1-A
           PERFORM VARYING I3 FROM 8 BY -1
                     UNTIL I3 < 1
              DIVIDE SPH-A1                    BY 2
                                        GIVING SPH-A1
                                     REMAINDER SPH-X8-B (I3)
              DIVIDE SPH-B1                    BY 2
                                        GIVING SPH-B1
                                     REMAINDER SPH-Y8-B (I3)
           END-PERFORM
           PERFORM VARYING I3 FROM 1 BY 1
                     UNTIL I3 > 8
              IF
                   SPH-X8-B (I3)                = 0
              OR   SPH-Y8-B (I3)                = 0
                   MOVE ZERO                   TO SPH-X8-B (I3)
                                                  SPH-Y8-B (I3)
              END-IF
           END-PERFORM.
           COMPUTE SPH-A1                       = SPH-Y8-B (8)
                                                + SPH-Y8-B (7) * 2
                                                + SPH-Y8-B (6) * 4
                                                + SPH-Y8-B (5) * 8
                                                + SPH-Y8-B (4) * 16
                                                + SPH-Y8-B (3) * 32
                                                + SPH-Y8-B (2) * 64
                                                + SPH-Y8-B (1) * 128
           MOVE SPH-A1-A                       TO BIGBUFF2 (I1:1).
       Z18A-99.
           EXIT.


       Z19-U-TEST SECTION.
      ******************************************************************
      * TEST FUER SHADED U
      ******************************************************************
       Z19-10.
      *-----------------------------------------------------------------
      * TEXT
      *-----------------------------------------------------------------
           MOVE "U"                            TO SPH-SATZ
           MOVE X"0000"                        TO SPH-SATZ (2:)
           MOVE SPH-SATZ                       TO SPH-TEXT-UTF
           MOVE 1000                           TO SPH-X
           MOVE 3000                           TO SPH-Y

      *-----------------------------------------------------------------
      * FONT
      *-----------------------------------------------------------------
           MOVE LOW-VALUE                      TO SPH-LOGFONT
           MOVE SPH-DEF-FACENAME               TO SPH-LFFACENAME
           MOVE SPH-DEF-WEIGHT                 TO SPH-LFWEIGHT
           MOVE SPH-DEF-PITCHANDFAMILY         TO SPH-PITCHANDFAMILY
           MOVE 500                            TO SPH-HEIGHT.
           MOVE WKA-JA                         TO SPS-HEIGHT
           MOVE 10                             TO SPH-PITCH.
           MOVE WKA-NEIN                       TO SPS-PITCH
           PERFORM Z14-FONT.

           MOVE 1                              TO I-C
           MOVE 2                              TO I-L
           CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TCPPL

           MOVE SPH-X                          TO SPH-2LEFT
                                                  SPH-2RIGHT
           MOVE SPH-Y                          TO SPH-2TOP
                                                  SPH-2BOTTOM
                                                  SPH-text-y
           ADD  SPH-TCX                        TO SPH-2RIGHT
           ADD  SPH-TCY                        TO SPH-2BOTTOM

           SUBTRACT SPH-2LEFT                FROM SPH-2RIGHT
                                           GIVING SPH-W-X
           SUBTRACT SPH-2TOP                 FROM SPH-2BOTTOM
                                           GIVING SPH-W-Y
           PERFORM Z13-TEXTOUT.
       Z19-99.
           EXIT.


       Z20-U-TEST SECTION.
      ******************************************************************
      * TEST FUER SHADED U
      ******************************************************************
       Z20-10.
      *-----------------------------------------------------------------
      * TEXT
      *-----------------------------------------------------------------
           MOVE "U"                            TO SPH-SATZ
           MOVE X"0000"                        TO SPH-SATZ (2:)
           MOVE 1000                           TO SPH-X
           MOVE 2000                           TO SPH-Y

      *-----------------------------------------------------------------
      * FONT
      *-----------------------------------------------------------------
           MOVE LOW-VALUE                      TO SPH-LOGFONT
           MOVE SPH-DEF-FACENAME               TO SPH-LFFACENAME
           MOVE SPH-DEF-WEIGHT                 TO SPH-LFWEIGHT
           MOVE SPH-DEF-PITCHANDFAMILY         TO SPH-PITCHANDFAMILY
           MOVE 500                            TO SPH-HEIGHT.
           MOVE WKA-JA                         TO SPS-HEIGHT
           MOVE 10                             TO SPH-PITCH.
           MOVE WKA-NEIN                       TO SPS-PITCH
           PERFORM Z14-FONT.

           MOVE 1                              TO I-C
           MOVE 1                              TO I-L
           CALL WINAPI 'GetTextExtentPoint32A'
                                  USING
                                  BY VALUE SPH-HDC
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
                                  BY REFERENCE SPH-TCPPL

           MOVE SPH-X                          TO SPH-2LEFT
                                                  SPH-2RIGHT
           MOVE SPH-Y                          TO SPH-2TOP
                                                  SPH-2BOTTOM
           ADD  SPH-TCX                        TO SPH-2RIGHT
           ADD  SPH-TCY                        TO SPH-2BOTTOM

           SUBTRACT SPH-2LEFT                FROM SPH-2RIGHT
                                           GIVING SPH-W-X
           SUBTRACT SPH-2TOP                 FROM SPH-2BOTTOM
                                           GIVING SPH-W-Y

      *-----------------------------------------------------------------
      * BITMAP, DC ...
      *-----------------------------------------------------------------
           PERFORM Z25-LOE-COMPW2
           PERFORM Z26-CRE-COMPW2.

           PERFORM Z29-STORE.

      *-----------------------------------------------------------------
      * BITMAP LADEN
      *-----------------------------------------------------------------
           MOVE 11                             TO I-SH
           IF
                SPH-SHADE-HBMP (I-SH)           = ZERO
                MOVE I-SH                      TO SPH-N2
                MOVE WKB-SHADE-B (I-SH)        TO I-X
                IF
                     SPH-TT                 NOT = SPACE
                     STRING SPH-LWT
                            "\"
                            SPH-TT
                            "\TEMP\INTEX_SHADE_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                ELSE
                     STRING "INTEX_SHADE_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                END-IF
                CALL WINAPI "LoadImageA"
                                  USING
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  BY VALUE 0       SIZE 4
                                  BY VALUE I-X
                                  BY VALUE I-X
                                  BY VALUE H"8010" SIZE 4
                                  RETURNING SPH-SHADE-HBMP (I-SH)
                IF
                     SPH-SHADE-HBMP (I-SH)      = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                CALL WINAPI "CreatePatternBrush"
                                  USING
                                  BY VALUE SPH-SHADE-HBMP   (I-SH)
                                  RETURNING SPH-BRUSH-SHADE (I-SH)
                IF
                     SPH-BRUSH-SHADE (I-SH)     = 0
                     CALL WINAPI "GetLastError"
                                      RETURNING SPH-RC
                END-IF
           END-IF.

      *-----------------------------------------------------------------
      * BITMAP LADEN INVERS
      *-----------------------------------------------------------------
           IF
                SPH-SHADEI-HBMP (I-SH)          = ZERO
                MOVE I-SH                      TO SPH-N2
                MOVE WKB-SHADE-B (I-SH)        TO I-X
                IF
                     SPH-TT                 NOT = SPACE
                     STRING SPH-LWT
                            "\"
                            SPH-TT
                            "\TEMP\INTEX_SHADEI_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                ELSE
                     STRING "INTEX_SHADEI_"
                            SPH-N2-A
                            ".BMP"
                            X"00"
                                                  DELIMITED BY "     "
                                             INTO SPH-TEXT
                END-IF
                CALL WINAPI "LoadImageA"
                                  USING
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE SPH-TEXT
                                  BY VALUE 0       SIZE 4
                                  BY VALUE I-X
                                  BY VALUE I-X
                                  BY VALUE H"8010" SIZE 4
                                  RETURNING SPH-SHADEI-HBMP (I-SH)
                IF
                     SPH-SHADEI-HBMP (I-SH)     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                CALL WINAPI "CreatePatternBrush"
                                  USING
                                  BY VALUE SPH-SHADEI-HBMP   (I-SH)
                                  RETURNING SPH-BRUSH-SHADEI (I-SH)
                IF
                     SPH-BRUSH-SHADEI (I-SH)    = 0
                     CALL WINAPI "GetLastError"
                                      RETURNING SPH-RC
                END-IF
           END-IF.

      *-----------------------------------------------------------------
      * RECT IN COMPW2 SICHERN
      *-----------------------------------------------------------------
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE SPH-BMP-COMPW2
                                  RETURNING SPH-RC.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCINVERT SIZE 4
                                  RETURNING SPH-RC.

      *-----------------------------------------------------------------
      * GETDIBITS
      *-----------------------------------------------------------------
                MOVE LOW-VALUE                 TO BITMAPINFOHEADER
                MOVE 40                        TO BISIZE
                MOVE SPH-W-X                   TO BIWIDTH
                MOVE SPH-W-Y                   TO BIHEIGHT
                MOVE 1                         TO BIPLANES
                MOVE 1                         TO BIBITCOUNT
                MOVE X"FFFFFF0000000000"
                                               TO RGBQUADS
                CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE SPH-BMP-COMPW2
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY VALUE 0           SIZE 4
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF
                MOVE LOW-VALUE                 TO BIGBUFF1
                CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE SPH-BMP-COMPW2
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF1
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC

           DIVIDE BISIZEIMAGE                  BY SPH-W-Y
                                           GIVING SPH-SC-X
           MOVE SPH-W-Y                        TO SPH-SC-Y

           MOVE ZERO                           TO I-B
           PERFORM VARYING I-Y FROM 1 BY 1
                     UNTIL I-Y > SPH-SC-Y
              PERFORM VARYING I-X FROM 1 BY 1
                        UNTIL I-X > SPH-SC-X
                 ADD  1                        TO I-B
                 IF
                      BIGBUFF1 (I-B:1)          = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF1 (I-B:1)      NOT = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF1 (I-B:1)          = X"ff"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF1 (I-B:1)      NOT = X"ff"
                      MOVE 1 TO I4
                 END-IF
              END-PERFORM
           END-PERFORM.

           PERFORM Z25-LOE-COMPW2.

      *-----------------------------------------------------------------
      * RASTER
      *-----------------------------------------------------------------
           PERFORM Z27-LOE-COMPW3
           PERFORM Z28-CRE-COMPW3.

           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC.
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-SHADE (I-SH)
                                  RETURNING SPH-RC.
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE SPH-BMP-COMPW3
                                  RETURNING SPH-RC.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           MOVE LOW-VALUE                      TO BIGBUFF2
           CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE SPH-BMP-COMPW3
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF2
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC


           DIVIDE BISIZEIMAGE                  BY SPH-W-Y
                                           GIVING SPH-SC-X
           MOVE SPH-W-Y                        TO SPH-SC-Y

           MOVE ZERO                           TO I-B
           PERFORM VARYING I-Y FROM 1 BY 1
                     UNTIL I-Y > SPH-SC-Y
              PERFORM VARYING I-X FROM 1 BY 1
                        UNTIL I-X > SPH-SC-X
                 ADD  1                        TO I-B
                 IF
                      BIGBUFF2 (I-B:1)          = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF2 (I-B:1)      NOT = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF2 (I-B:1)          = X"ff"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF2 (I-B:1)      NOT = X"ff"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF1 (I-B:1)      NOT = BIGBUFF2 (I-B:1)
                      PERFORM Z20A-DIFF
                 END-IF
              END-PERFORM
           END-PERFORM.

           PERFORM Z27-LOE-COMPW3.

      *-----------------------------------------------------------------
      * BUCHSTABE
      *-----------------------------------------------------------------
           PERFORM Z31-LOE-COMPW4
           PERFORM Z32-CRE-COMPW4.

           MOVE ZERO                       TO SPH-3LEFT
           MOVE ZERO                       TO SPH-3TOP
           MOVE SPH-W-X                    TO SPH-3RIGHT
           MOVE SPH-W-Y                    TO SPH-3BOTTOM

           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-FONT
           CALL WINAPI 'SetBkMode'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE TRANSPARENT SIZE 4
           CALL WINAPI 'SetTextColor'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-COL-BLACK
           CALL WINAPI 'SetBkColor'
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-COL-WHITE
           CALL WINAPI "FillRect"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY REFERENCE SPH-2RECT
                                  BY VALUE SPH-BRUSH-WHITE
                                  RETURNING SPH-RC.
           CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
                                  RETURNING SPH-RC
           CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
                                  RETURNING SPH-RC
           CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
                                  RETURNING SPH-RC
           CALL WINAPI "TextOutA"
                                  USING
                                  BY VALUE SPH-HDC-COMPI
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY REFERENCE SPH-SATZ
                                  BY VALUE I-L
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-BMP-COMPW4
                                  RETURNING SPH-RC.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC

           MOVE LOW-VALUE                      TO BIGBUFF3
           CALL WINAPI "GetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-BMP-COMPW4
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF3
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
                IF
                     SPH-RC                     = 0
                     CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
                END-IF.


           DIVIDE BISIZEIMAGE                  BY SPH-W-Y
                                           GIVING SPH-SC-X
           MOVE SPH-W-Y                        TO SPH-SC-Y

           MOVE ZERO                           TO I-B
           PERFORM VARYING I-Y FROM 1 BY 1
                     UNTIL I-Y > SPH-SC-Y
              PERFORM VARYING I-X FROM 1 BY 1
                        UNTIL I-X > SPH-SC-X
                 ADD  1                        TO I-B
                 IF
                      BIGBUFF3 (I-B:1)          = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF3 (I-B:1)      NOT = X"00"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF3 (I-B:1)          = X"ff"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF3 (I-B:1)      NOT = X"ff"
                      MOVE 1 TO I4
                 END-IF
                 IF
                      BIGBUFF3 (I-B:1)      NOT = X"ff"
                 AND  I-Y                       > 3000
                      MOVE 1 TO I4
                 END-IF
              END-PERFORM
           END-PERFORM.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

      *-----------------------------------------------------------------
      * ALTES BILD ZURUECK
      *-----------------------------------------------------------------
           PERFORM Z30-RESTORE.

           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-BMP-COMPW4
                                  RETURNING SPH-RC.
           CALL WINAPI "SetDIBits"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-BMP-COMPW4
                                  BY VALUE 0           SIZE 4
                                  BY VALUE SPH-W-Y
                                  BY REFERENCE BIGBUFF2
                                  BY REFERENCE BITMAPINFO
                                  BY VALUE 0           SIZE 4
                                  RETURNING SPH-RC
           IF
                SPH-RC                          = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF.

      *-----------------------------------------------------------------
      * KONTROLLE
      *-----------------------------------------------------------------
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDCW
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE SPH-2LEFT
                                  BY VALUE SPH-2TOP
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.

           PERFORM Z31-LOE-COMPW4.
       Z20-99.
           EXIT.


       Z20A-DIFF SECTION.
      ******************************************************************
      * DIE BITMAP FAENGT VON UNTEN AN!
      ******************************************************************
       Z20A-10.
           MOVE BIGBUFF1 (I-B:1)               TO SPH-A1-A
           MOVE BIGBUFF2 (I-B:1)               TO SPH-B1-A
           MOVE BIGBUFF3 (I-B:1)               TO SPH-C1-A
           PERFORM VARYING I4 FROM 8 BY -1
                     UNTIL I4 < 1
              DIVIDE SPH-A1                    BY 2
                                        GIVING SPH-A1
                                     REMAINDER SPH-X8-B (I4)
              DIVIDE SPH-B1                    BY 2
                                        GIVING SPH-B1
                                     REMAINDER SPH-Y8-B (I4)
              DIVIDE SPH-C1                    BY 2
                                        GIVING SPH-C1
                                     REMAINDER SPH-Z8-B (I4)
           END-PERFORM
           PERFORM VARYING I4 FROM 1 BY 1
                     UNTIL I4 > 8
              IF
                  (SPH-X8-B (I4)                = 0
              OR   SPH-Y8-B (I4)                = 0)
      *!!!!!  AND  SPH-Z8-B (I4)                = 1
                   MOVE ZERO                   TO SPH-X8-B (I4)
                                                  SPH-Y8-B (I4)
              END-IF
           END-PERFORM.
           COMPUTE SPH-A1                       = SPH-Y8-B (8)
                                                + SPH-Y8-B (7) * 2
                                                + SPH-Y8-B (6) * 4
                                                + SPH-Y8-B (5) * 8
                                                + SPH-Y8-B (4) * 16
                                                + SPH-Y8-B (3) * 32
                                                + SPH-Y8-B (2) * 64
                                                + SPH-Y8-B (1) * 128
           MOVE SPH-A1-A                       TO BIGBUFF2 (I-B:1).
       Z20A-99.
           EXIT.


       Z21-GETDC SECTION.
      ******************************************************************
      * GETDC + SETZEN FONT ETC
      ******************************************************************
       Z21-10.
      *    IF
      *         SPH-HDCW                        = ZERO
      *         CALL WINAPI "GetDC"
      *                           USING
      *                           BY VALUE HWINDOW
      *                           RETURNING SPH-HDCW
      *    END-IF
      *    CALL WINAPI 'SetBkMode'
      *                           USING
      *                           BY VALUE SPH-HDCW
      *                           BY VALUE TRANSPARENT SIZE 4
      *    CALL WINAPI 'SetTextColor'
      *                           USING
      *                           BY VALUE SPH-HDCW
      *                           BY VALUE SPH-BRUSH-BLACK
      *    CALL WINAPI 'SetBkColor'
      *                           USING
      *                           BY VALUE SPH-HDCW
      *                           BY VALUE SPH-BRUSH-WHITE.
      *    CALL WINAPI "SelectObject"
      *                           USING
      *                           BY VALUE SPH-HDCW
      *                           BY VALUE SPH-FONT.
       Z21-99.
           EXIT.


       Z22-RELEASEDC SECTION.
      ******************************************************************
      * RELEASEDC
      ******************************************************************
       Z22-10.
      *    IF
      *         SPH-HDCW                    NOT = ZERO
      *         CALL WINAPI "ReleaseDC"
      *                           USING
      *                           BY VALUE HWINDOW
      *                           BY VALUE SPH-HDCW
      *                           RETURNING SPH-RC
      *    END-IF
      *    MOVE ZERO                           TO SPH-HDCW.
       Z22-99.
           EXIT.


       Z23-LOE-COMPW1 SECTION.
      ******************************************************************
      * DELETE ETC
      ******************************************************************
       Z23-10.
           IF
                SPH-BMP-COMPW1              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW1
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW1.
           IF
                SPH-HDC-COMPW1               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW1.
       Z23-99.
           EXIT.


       Z24-CRE-COMPW1 SECTION.
      ******************************************************************
      * CREATE ETC
      ******************************************************************
       Z24-10.
           IF
                SPH-BMP-COMPW1              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW1
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW1.
           IF
                SPH-HDC-COMPW1               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW1.

           CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPW1
           IF
                SPH-HDC-COMP1                   = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  RETURNING SPH-BMP-COMPW1
           IF
                SPH-BMP-COMPW1                  = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW1
                                  BY VALUE SPH-BMP-COMPW1
                                  RETURNING SPH-RC.
       Z24-99.
           EXIT.


       Z25-LOE-COMPW2 SECTION.
      ******************************************************************
      * DELETE ETC
      ******************************************************************
       Z25-10.
           IF
                SPH-BMP-COMPW2              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW2
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW2.
           IF
                SPH-HDC-COMPW2               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW2.
       Z25-99.
           EXIT.


       Z26-CRE-COMPW2 SECTION.
      ******************************************************************
      * CREATE ETC
      ******************************************************************
       Z26-10.
           IF
                SPH-BMP-COMPW2              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW2
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW2.
           IF
                SPH-HDC-COMPW2               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW2.

           CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPW2
           IF
                SPH-HDC-COMP1                   = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  RETURNING SPH-BMP-COMPW2
           IF
                SPH-BMP-COMPW2                  = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW2
                                  BY VALUE SPH-BMP-COMPW2
                                  RETURNING SPH-RC.
       Z26-99.
           EXIT.


       Z27-LOE-COMPW3 SECTION.
      ******************************************************************
      * DELETE ETC
      ******************************************************************
       Z27-10.
           IF
                SPH-BMP-COMPW3              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW3
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW3.
           IF
                SPH-HDC-COMPW3               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW3.
       Z27-99.
           EXIT.


       Z28-CRE-COMPW3 SECTION.
      ******************************************************************
      * CREATE ETC
      ******************************************************************
       Z28-10.
           IF
                SPH-BMP-COMPW3              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW3
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW3.
           IF
                SPH-HDC-COMPW3               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW3.

           CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPW3
           IF
                SPH-HDC-COMP1                   = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  RETURNING SPH-BMP-COMPW3
           IF
                SPH-BMP-COMPW3                  = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW3
                                  BY VALUE SPH-BMP-COMPW3
                                  RETURNING SPH-RC.
       Z28-99.
           EXIT.


       Z29-STORE SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z29-10.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMPS
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.
       Z29-99.
           EXIT.


       Z30-RESTORE SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z30-10.
           CALL WINAPI "BitBlt"
                                  USING
                                  BY VALUE SPH-HDC-COMP1
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SPH-P-X
                                  BY VALUE SPH-P-Y
                                  BY VALUE SPH-HDC-COMPS
                                  BY VALUE 0 SIZE 4
                                  BY VALUE 0 SIZE 4
                                  BY VALUE SRCCOPY SIZE 4
                                  RETURNING SPH-RC.
       Z30-99.
           EXIT.


       Z31-LOE-COMPW4 SECTION.
      ******************************************************************
      * DELETE ETC
      ******************************************************************
       Z31-10.
           IF
                SPH-BMP-COMPW4              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW4
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW4.
           IF
                SPH-HDC-COMPW4               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW4.
       Z31-99.
           EXIT.


       Z32-CRE-COMPW4 SECTION.
      ******************************************************************
      * CREATE ETC
      ******************************************************************
       Z32-10.
           IF
                SPH-BMP-COMPW4              NOT = ZERO
                CALL WINAPI "DeleteObject"
                                  USING
                                  BY VALUE SPH-BMP-COMPW4
                                  RETURNING SPH-RC
           END-IF
           MOVE ZERO                           TO SPH-BMP-COMPW4.
           IF
                SPH-HDC-COMPW4               NOT = 0
                CALL WINAPI "DeleteDC"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  RETURNING SPH-RC
           END-IF.
           MOVE ZERO                           TO SPH-HDC-COMPW4.

           CALL WINAPI "CreateCompatibleDC"
                                  USING
                                  BY VALUE SPH-HDC
                                  RETURNING SPH-HDC-COMPW4
           IF
                SPH-HDC-COMP1                   = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "CreateCompatibleBitmap"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-W-X
                                  BY VALUE SPH-W-Y
                                  RETURNING SPH-BMP-COMPW4
           IF
                SPH-BMP-COMPW4                  = 0
                CALL WINAPI "GetLastError"
                                  RETURNING SPH-RC
           END-IF
           CALL WINAPI "SelectObject"
                                  USING
                                  BY VALUE SPH-HDC-COMPW4
                                  BY VALUE SPH-BMP-COMPW4
                                  RETURNING SPH-RC.
       Z32-99.
           EXIT.


       Z34-SEITE-MIN-MAX SECTION.
      ******************************************************************
      * SEITE-V UND SEITE-B SETZEN
      ******************************************************************
       Z34-10.
           IF
                SPH-2TOP                        < SPH-Y-SEITE-V
                IF
                     SPH-TTOP                  >= ZERO
                     MOVE SPH-2TOP             TO SPH-Y-SEITE-V
                ELSE
                     MOVE ZERO                 TO SPH-Y-SEITE-V
                END-IF
           END-IF
           IF
                SPH-2LEFT                       < SPH-X-SEITE-V
                IF
                     SPH-TLEFT                 >= ZERO
                     MOVE SPH-2LEFT            TO SPH-X-SEITE-V
                ELSE
                     MOVE ZERO                 TO SPH-X-SEITE-V
                END-IF
           END-IF
           IF
                SPH-2BOTTOM                     > SPH-Y-SEITE-B
                MOVE SPH-2BOTTOM               TO SPH-Y-SEITE-B
           END-IF
           IF
                SPH-2RIGHT                      > SPH-X-SEITE-B
                MOVE SPH-2RIGHT                TO SPH-X-SEITE-B
           END-IF.
       Z34-99.
           EXIT.


       Z35-SEITE-MIN-MAX SECTION.
      ******************************************************************
      * SEITE-V UND SEITE-B SETZEN BEI TEXTEN
      ******************************************************************
       Z35-10.
           IF
                SPH-TTOP                        < SPH-Y-SEITE-V
           AND  SPH-TTOP                       >= ZERO
                MOVE SPH-TTOP                  TO SPH-Y-SEITE-V
           END-IF
           IF
                SPH-TLEFT                       < SPH-X-SEITE-V
           AND  SPH-TLEFT                      >= ZERO
                MOVE SPH-TLEFT                 TO SPH-X-SEITE-V
           END-IF
           IF
                (SPH-TTOP + SPH-TCY)            > SPH-Y-SEITE-B
                MOVE SPH-TTOP                  TO SPH-Y-SEITE-B
                ADD  SPH-TCY                   TO SPH-Y-SEITE-B
           END-IF
           IF
                (SPH-TLEFT + SPH-TCX)           > SPH-X-SEITE-B
                MOVE SPH-TLEFT                 TO SPH-X-SEITE-B
                ADD  SPH-TCX                   TO SPH-X-SEITE-B
           END-IF.
       Z35-99.
           EXIT.


       Z36-CALLBACK SECTION.
      ******************************************************************
      * CALLBACK FUER ENUMFONTS
      ******************************************************************
       Z36-10.
           ENTRY "EnumFontsProc1"
                                  USING
                                  BY REFERENCE LNK-LOGFONT
                                  BY REFERENCE LNK-TEXTMETRIC
                                  BY VALUE     LNK-DWTYPE
                                  BY REFERENCE LNK-DATA.

           MOVE 1                              TO LONGRESULT.
           EXIT PROGRAM RETURNING LONGRESULT.
       Z36-99.
           EXIT.


       Z37-PROTO SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z37-10.
           IF
                SPS-PROTO                       = SPACE
                OPEN EXTEND PROTO
                IF
                     FILE-NICHT-VORHANDEN
                     OPEN OUTPUT PROTO
                END-IF
                IF
                     NOT FILE-NOTOK
                     MOVE WKA-JA               TO SPS-PROTO
                ELSE
                     MOVE WKM-2176             TO SPH-MNR
                     MOVE "open proto"         TO SPH-MPAR1
                     MOVE FILE-RC              TO SPH-MPAR1 (12:2)
                     MOVE PROTOEQ              TO SPH-MPAR2
                     PERFORM Z7-ERROR
                END-IF
           END-IF.

           IF
                SPS-PROTO                       = WKA-JA
                WRITE PROTO-SATZ
                CLOSE PROTO
                MOVE SPACE                     TO SPS-PROTO
           END-IF.

           MOVE SPACE                          TO PROTO-SATZ.
       Z37-99.
           EXIT.


       Z38-FAKTOREN SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z38-10.
           DIVIDE WKB-DPI-IST                  BY WKB-DPI-SOLL
                                           GIVING WKB-FAKTOR-XY.
      *-----------------------------------------------------------------
      * PAGE SIZE DEFAULT=LETTER.
      *-----------------------------------------------------------------
           MULTIPLY 3300                       BY WKB-FAKTOR-XY
                                           GIVING SPH-PAGE-Y
           DIVIDE WKB-DPI-IST                  BY 2
                                           GIVING SPH-MARGIN-Y
           MULTIPLY 2550                       BY WKB-FAKTOR-XY
                                           GIVING SPH-PAGE-X
           MULTIPLY 50                         BY WKB-FAKTOR-XY
                                           GIVING SPH-MARGIN-X.
           MULTIPLY 50                         BY WKB-FAKTOR-XY
                                           GIVING SPH-START-Y
           MULTIPLY 25                         BY WKB-FAKTOR-XY
                                           GIVING SPH-START-X.
       Z38-99.
           EXIT.


       Z39-HMI-VMI SECTION.
      ******************************************************************
      * HMI = DPI / PITCH(10)                (30 BEI 300DPI)
      * VMI = DPI / LPI(6)                   (50 BEI 300DPI)
      ******************************************************************
       Z39-10.
           IF
                SPH-PITCH                       = ZERO
                MOVE 10                        TO SPH-PITCH
           END-IF
           COMPUTE SPH-HMI ROUNDED              = WKB-DPI-IST
                                                / SPH-PITCH
           COMPUTE SPH-VMI ROUNDED              = WKB-DPI-IST
                                                / 6.

           MOVE "DPI:"                         TO PROTO-SATZ
           MOVE DM2YRESOLUTION                 TO SPH-Z10
           MOVE SPH-Z10-A                      TO PROTO-SATZ (5:)
           MOVE SPH-HMI                        TO SPH-Z10
           MOVE SPH-Z10-A                      TO PROTO-SATZ (16:)
           MOVE SPH-VMI                        TO SPH-Z10
           MOVE SPH-Z10-A                      TO PROTO-SATZ (27:)
           MOVE SPH-PITCH                      TO SPH-Z10
           MOVE SPH-Z10-A                      TO PROTO-SATZ (38:)
           MOVE WKB-DPI-IST                    TO SPH-Z10
           MOVE SPH-Z10-A                      TO PROTO-SATZ (49:)
           PERFORM Z37-PROTO.
       Z39-99.
           EXIT.

       Z40-PROP SECTION.
      ******************************************************************
      *
      ******************************************************************
       Z40-10.
           MOVE SPH-RC                         TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (11:)
           MOVE DM2YRESOLUTION                 TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (18:)
           MOVE DM2PRINTQUALITY                TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (25:)
           MOVE DM2SPECVERSION                 TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (32:)
           MOVE DM2DRIVERVERSION               TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (39:)
           MOVE DM2SIZE                        TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (46:)
           MOVE DM2ORIENTATION                 TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (53:)
           MOVE DM2SIZE                        TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (60:)
           MOVE DM2DEFAULTSOURCE               TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (67:)
           PERFORM Z37-PROTO

           MOVE DM2PAPERSIZE                   TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (11:)
           MOVE DM2PAPERLENGTH                 TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (18:)
           MOVE DM2PAPERWIDTH                  TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (25:)
           MOVE DM2SCALE                       TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (32:)
           MOVE DM2COPIES                      TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (39:)
           MOVE DM2COLOR                       TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (46:)
           MOVE DM2DUPLEX                      TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (53:)
           MOVE DM2TTOPTION                    TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (60:)
           MOVE DM2COLLATE                     TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (67:)
           PERFORM Z37-PROTO.

           MOVE DM2LOGPIXELS                   TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (11:)
           MOVE DM2BITSPERPEL                  TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (18:)
           MOVE DM2PELSWIDTH                   TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (25:)
           MOVE DM2PELSHEIGHT                  TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (32:)
           MOVE DM2DISPLAYFLAGS                TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (39:)
           MOVE DM2PANNINGWIDTH                TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (46:)
           MOVE WKB-DPI-IST                    TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (53:)
           MOVE SPH-LPIX-X                     TO SPH-Z6
           MOVE SPH-Z6-A                       TO PROTO-SATZ (60:)
           PERFORM Z37-PROTO.
       Z40-99.
           EXIT.
